add multiple roles upon registration
-
Hi –
I’m hoping you might reveal the action hook used by rcp when assigning a role to a subscriber
I’d like to add a particular additional role based on a specific starting role. something like someone subscribes as an ‘contributor’ – I also want to give them ‘author’ role. (I don’t want to base it on capabilities, but rather really need to assign roles)
this code doesn’t quite cover it because it doesn’t identify what the subscribed role is, it takes the default new user role (subscriber), while I want it for when a new user joins or an existing user upgrades subscription
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(‘screen_reader’);}
thanks
The topic ‘add multiple roles upon registration’ is closed to new replies.