• Resolved whdsolutions

    (@whdsolutions)


    The plugin does not really help us as when they register it logs them in without our approval. Surely they shouldn’t have any access until we approve them.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • A.Tariq

    (@arsalantariq)

    Hi @whdsolutions,

    Thanks for using the plugin,

    I hope you are doing well, The issue normally happens because the plugin/theme through which you are creating the registration form, logs you in automatically upon registration.

    This process bypasses the ‘New User Approve’ validations.

    For ‘New User approves’ to work properly with your registration form you will have to disable the auto-login functionality of the plugin/theme you are using for the registration form.

    Unfortunately, this cannot be achieved from our end, you will have to contact plugin/theme support for a way to disable the auto-login functionality.`

    Thanks & Regards

    WP Experts Support Team

    A.Tariq

    (@arsalantariq)

    Hi @whdsolutions,

    Alternatively, you can use this code to log out pending/denied users and redirect them to a custom page.

    add_action('init', 'nua_logout_pending_denied_users');
    function nua_logout_pending_denied_users(){
    	$user = wp_get_current_user();
    
        if ( $user instanceof WP_User && !empty($user->ID) && is_array($user->roles) && !in_array('administrator', $user->roles)){ 
    
    		$user_status = get_user_meta( $user->ID, 'pw_user_status', true );
    
    		if ( 'denied' == $user_status || 'pending' == $user_status ) {
    			wp_logout();
    
    			// custom URL to redirect after logout
    			wp_safe_redirect( home_url() ); 
    			exit();
    		}
        }
    }

    Thanks

    Thread Starter whdsolutions

    (@whdsolutions)

    Where do I add this please?

    A.Tariq

    (@arsalantariq)

    Hi @whdsolutions,

    You can add this Appearance -> Theme File Editor -> function.php.

    Thanks

    Hi @whdsolutions,

    We haven’t heard from you so we’re going to mark this thread as resolved. Feel free to open a new one if you need it.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Register and it logs you in’ is closed to new replies.