xwp / stream

🗄️ Stream plugin for WordPress

Home Page:https://wordpress.org/plugins/stream/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom usage of wp_signon does not track user logins correctly

shadyvb opened this issue · comments

As reported in support forums

I'm using the "password protected" plugin that will force users to login using a custom form and a custom password. I use this plugin to prevent access to the whole site from unwanted users.
Once done, if the first custom password management login is successfull, the code will signon on users accordingly:

/* begin my code */
        $creds = array();
        $creds['user_login'] = 'username';
        $creds['user_password'] = 'thepassword';
    $creds['remember'] = true;
    $user = wp_signon( $creds, false );
    if ( is_wp_error($user) )
        echo $user->get_error_message();
       // run it before the headers and cookies are sent
       add_action( 'after_setup_theme', 'custom_login' );
/* end my code */