• Resolved wasanajones

    (@wasanajones)


    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    This is the forum for the free Restrict Content. wordpress.org policy doesn’t allow support of paid products here. Please open a ticket at restrictcontentpro.com and we’ll be happy to assist.

    Thread Starter wasanajones

    (@wasanajones)

    thanks, my bad – I thought we could do this with the repository plugin

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘add multiple roles upon registration’ is closed to new replies.