• Hello,

    Let’s say I have 3 sites built using multisite, I want a user to register only once to be registered on all 3 sites. How can i do that?

    Thanks a lot!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Something like this could do it for you in “mu-plugins”:

    When a user registers, that user will be added to each blog as a subscriber.

    add_action( 'user_register', 'ds_new_user_meta', 10, 2);
    
    function ds_new_user_meta($user_id) {
    //$blogs = array(1,2,3);
    $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ", $wpdb->siteid), ARRAY_A );
    foreach ($blogs as $blog) {
    add_user_to_blog($blog['blog_id'], $user_id, 'subscriber');
    }
    // adds every new user to all "public" blogs
    }
    Thread Starter ygmgbg

    (@ygmgbg)

    thx, i will try that.

    Where would this code be added? Is this still the best method?

    Thx
    CT

    If you;re looking for users to just have permission to comment while logged, in they have that by default.

    If you need more, use the code above like dsader said, in mu-plugins folder.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘one user registration for multiple sites’ is closed to new replies.