Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › Add additional role to multisite users › Reply To: Add additional role to multisite users
		23/07/2019 at 14:28
		
		#5842
		
		
		
	
Keymaster
		
		
	Hi,
May be this code will give a starting point:
if (is_multisite()) {
    add_action( 'wpmu_activate_user', 'add_secondary_role', 10, 1 );
} else {
    add_action( 'user_register', 'add_secondary_role', 10, 1 );
}
 
function add_secondary_role( $user_id ) {
 
    $user = get_user_by('id', $user_id);
    $user->add_role('custom_role_id');
 
}
I will be out of office until July 31st.