I made a little plugin that let me copy users from one blog to another in WordPress multisite.1
I thought I’d have to use switch_to or something but I didn’t. It’d be easy to expand this to do more tricks for you and have more shortcode parameters but I don’t need them so it is what it is.
function copy_users_home($atts){
$a = shortcode_atts( array(
'id' => '', //copy from this site
), $atts );
$copy_site_id = $a['id'];
$the_users = get_users( 'blog_id='.$copy_site_id );
foreach ( $the_users as $user ) {
echo $user->ID . '<br>';// I just like to see stuff happen sometimes
add_user_to_blog(1, $user->ID, 'subscriber');
}
//add_user_to_blog($blog_id, $user_id, $role);
}
add_shortcode( 'copy', 'copy_users_home' );
1 But you already knew that from the title.