Hi
I have made a custom registration form where people can sign up as instructors.
I am trying to add a second user role when they signup, but i cant get it to work. I am using multisite.
So what i want is that when someone registers as an instructor they also get the user role "vendor".
This is the code i tried (but nothing happens .. :/)
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('vendor');
}
@gsjaak_118
Instead of this, Register a new user role as "vendor" on your site and then set it as a default role for newly registered user(Assign permissions and roles which you want to give to that user role). I guess, this will do the trick. SO you need not to add a user role programatically at the time when users registering on your site
Hi Diana,
I was thinking about this indeed. I am trying to find a list of all the capabilities that are assigned to the instructor user role (i am pretty sure i saw a document about this the other day but i cant find it anymore..).
Could you provide me this list of capabilities?
Kind regards
@gsjaak_118
I guess this plugin works for you:
https://wordpress.org/plugins/user-role-editor/
thanks, i dont need a plugin
i just want to know all the capabilites that wplms assigns by default to an instructor. could you provide me this list?