Support » Plugin: Nextend Social Login and Register » Wp authenticate user on login

  • Resolved Marco Giannini

    (@gianemi2)


    Hi, thanks for this plugin. It helps me in a heavy height project.

    There’s a problem with it… I have to control if a user have a meta field empty or not. And I use wp_authenticate_user() filter for it.

    With the standard login there’s no problem with it. But with your plugin it skips completely the social login.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Gabor

    (@nextendweb_gabor)

    Hi @gianemi2!

    We aren’t running that filter on our code, because one of the parameters for this is the password and we don’t have access to that. Please send us the exact code you are using and then we can make some suggestions related to it! You could paste it into this forum or you could also send it to us in email: support@nextendweb.com

    add_filter('wp_authenticate_user', 'check_user_status',10,2);
    function check_user_status ($user, $password) {
        $user_id = $user->data->ID;
        //Controllo se l'utente รจ bloccato per frode
        $fraudBlock = get_user_meta($user_id, '_user_status_block', true);
        if($fraudBlock == 1){
            $user = new WP_Error( 'fraud_block', __( 'Account bloccato per frode.' ) );
        return $user;
    }

    Thanks for your help

    Plugin Support Gabor

    (@nextendweb_gabor)

    You could use this code for our logins:

    add_filter('nsl_facebook_is_login_allowed', 'nsl_block_fraud_login', 10, 3);
    
    add_filter('nsl_google_is_login_allowed', 'nsl_block_fraud_login', 10, 3);
    
    add_filter('nsl_twitter_is_login_allowed', 'nsl_block_fraud_login', 10, 3);
    
    function nsl_block_fraud_login($isLoginAllowed, $provider, $user_id)
    {
        $fraudBlock = get_user_meta($user_id, '_user_status_block', true);
        
        if ($fraudBlock == 1) {
            \NSL\Notices::addError(__('Account bloccato per frode.'));
            return false;
        }
        
        return $isLoginAllowed;
    }

    You only need to add it to those providers you use.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wp authenticate user on login’ is closed to new replies.