Title: different role
Last modified: April 20, 2021

---

# different role

 *  Resolved [albertoaranda](https://wordpress.org/support/users/albertoaranda/)
 * (@albertoaranda)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/different-role/)
 * Hello,
    I would like to assign a different role to the users who register with
   an email from @ gmail.com This would be possible? Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdifferent-role%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/different-role/#post-14345614)
 * Hi [@albertoaranda](https://wordpress.org/support/users/albertoaranda/)
 * You can try this code snippet:
 *     ```
       add_action("um_registration_complete","um_042121_change_user_role", 1, 2 );
       function um_042121_change_user_role( $user_id, $args ){
   
           if( isset( $args['user_email'] ) ){
   
               list($user, $domain) = explode('@', $args['user_email'] );
   
               if ($domain == 'gmail.com') {
                   wp_update_user( array( 'ID' => $user_id, 'role' => 'premium-member' ) );
               }
   
           }
       }
       ```
   
 * The above code will change the role to ‘premium-member’ when the email provider
   is Gmail.
 * Regards,
 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/different-role/#post-14364832)
 * Hey there!
 *  ..This thread has been inactive for a while so we’re going to go ahead and mark
   it Resolved. Please feel free to re-open this thread by changing the Topic Status
   to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂
 * Regards,
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/different-role/#post-14399577)
 * Note about the code:
 * You must use the RoleID see an example in this link:
 * [https://wordpress.org/support/topic/automatically-assign-user-role-based-on-email-domain/](https://wordpress.org/support/topic/automatically-assign-user-role-based-on-email-domain/)
    -  This reply was modified 5 years, 1 month ago by [missveronica](https://wordpress.org/support/users/missveronicatv/).

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

The topic ‘different role’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/different-role/#post-14399577)
 * Status: resolved