Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Giray

    (@giray)

    Wanted to add that I am registering users through Buddy Boss, just in case that has an impact on the solution. Thx.

    Plugin Author Caseproof LLC

    (@caseproof)

    Hi Giray,

    To add role on registration you can use this code snippet, modify it, and add at the end of your theme’s functions.php file:

    add_action( 'user_register', function( $user_id ) {
      $user = get_user_by( 'ID', $user_id );
      if ( /* Your condition here */ ) {
        $user->add_role( 'new-role' );
      }
    });

    By default users will have Subscriber role but thanks to this code they should also have New Role.

    Hopefully, that helps.

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

The topic ‘Multiple roles at registration’ is closed to new replies.