• Resolved albertoaranda

    (@albertoaranda)


    Hello,

    When a user registers, they are pending manual approval.

    But I want, that when registering for example users with email from @ gmail.com the account is automatically approved.

    Is it possible to do this from hook?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @albertoaranda

    Unfortunately, this requires customization on your end. We don’t have a code snippet at this moment but hopefully, someone in the forum has something similar and shares their solution here.

    Regards,

    Thread Starter albertoaranda

    (@albertoaranda)

    Thanks for the reply.

    Could you help me customize this? What would the cost be?

    Thanks

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @albertoaranda

    Here’s a custom code for changing the user role when a user uses gmail:

    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 user role to premium-member. The premium-member is a slug of the user role. You can change it with your own user role.

    Regards,

    Thread Starter albertoaranda

    (@albertoaranda)

    Thanks for your answer.

    And wouldn’t it be possible to change the account status (account_status) to approved for emails that are from gmail?

    Thanks again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hello, When a user registers, they are pending manual approval. But I want, th’ is closed to new replies.