The MU forums have moved to WordPress.org

Add New Users to Blog 2 and not Blog 1 (1 post)

  1. jlappas
    Member
    Posted 16 years ago #

    I need to allow users to register to blog = 2 but not automatically be added to primary blog = 1. I I have tried to use this code in mu-plugins:

    <?php add_action( 'wpmu_new_user', 'ds_new_user_meta', 10, 1);
    function ds_new_user_meta($user_id) {
    add_user_to_blog( '2', $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    update_usermeta($user_id, 'primary_blog', $blog);
    }
    ?>

    This code allows new users to sign up in blog 2 correctly but it also registering them for the primary blog 1. How can I get them to only register for blog 2 without being added to blog 1. I have tried adding a line to remove the user from blog 1 within this code but have not been successful. I think WP code automatically adds all users to blog 1. Can you please help?

About this Topic

  • Started 16 years ago by jlappas