Registration Options Per User Type

Home Forums Plugin Support Registration Options Per User Type

This topic contains 3 replies, has 2 voices, and was last updated by  consumerfocus 11 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #9000

    Is there a way to make it so some user types automatically register and others require an admin approval?

    #9003

    sourov amin
    Moderator

    Hello,

    Although there is no direct feature available for this but a piece of code can do the job for you.

    add_action('user_register', 'userAutoActivationModified', 20);
    	
    function userAutoActivationModified( $userID ){
        global $userMeta;
        $roleToAutoActive = 'subscriber';
        $role = $userMeta->getUserRole( $userID );
        if ($roleToAutoActive == $role)
            update_user_meta($userID, 'user_meta_user_status', 'active');
    }

    Put the following code in your functions.php (under current theme) or any plugin file. Don’t forget to replace $roleToAutoActive = 'subscriber'; with your targeted role which shall activate automatically.

    Please note, although the user will be activated, they will see default admin approval required message and an email of approval will be sent straightway if it is enabled. To get rid of the default admin approval required message, use ‘Do not use AJAX’ checkbox and use custom redirection where you can write something to show some direction to the user.

    #9024

    This does not seem to be working for me. It still forces the user to be authenticated by an admin

    #9025

    nevermind, i got it to work! Didnt realize the roleToAutoActive was case sensitive

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.