• Resolved Melissa Smith

    (@msmissa)


    Hello!
    I know that multisite setups share the user table for all subsites, but I have one subsite on a network that wants to restrict access to users who have been “pre-approved” by the admin. So I added UM to assign a site-specific named role, and customized the new user registration form to assign that custom role by default require admin approval.

    The problem is when a user who registered on another subsite wants to also request access to the site with the custom user role, they get an error that the email is already in use.

    If I add a link to the reset password page, the user can reset their password, but they bypass the admin approval that new users go through, and don’t get assigned that custom user role. They *can*, however, log into that site and now are confused because they’re logged in, but can’t access the restricted content because they’re missing the custom role assignment.

    Any ideas on how to create a better user experience where they can request content access from the admin, AND reset their password?

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @msmissa

    You need need to sync the user role across network sites with the following sample code:

    add_action("um_registration_complete", "um_add_user_to_main_site", 99, 2);
    function um_add_user_to_main_site( $user_id, $args ){
    
    		if( isset( $args['form_id'] ) && $args['form_id'] == 756 ){
    
    			$blog_id = 1;
    
    			um_fetch_user( $user_id );
    			
    			$role = um_user("role");
    			 
    			add_user_to_blog( $blog_id, $user_id, $role );
    
    		}
    
    		
    	}
    

    The above code will register that user to the main site or subsites.

    Regardsm

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @msmissa

    Please feel free to re-open this thread if any other questions come up and we’d be happy to help. ??

    Regards,

    Have the same problem
    Doesn’t work with code ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Allow existing multisite users to register a new role on subsite’ is closed to new replies.