You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//calls into persistent login plugin https://wordpress.org/plugins/wp-persistent-login/
if(!class_exists('WP_Persistent_Login_Manage_Sessions')){return;}
$user_id = $user->ID;
update_user_meta( $user_id, 'persistent_login_remember_me', 'true');
// get the users latest session from the database
$sessions = get_user_meta( $user_id, 'session_tokens', true );
if( is_array($sessions) ) {
// fetch the login time column from the array
$login_times = array_column($sessions, 'login');
// sort the sessions by login times (newest first)
array_multisort( $login_times, SORT_DESC, $sessions );
// get the key (verifier) of the first session
$session_verifier = array_key_first($sessions);
//remove the session from the database
$wp_login_manage_sessions = new WP_Persistent_Login_Manage_Sessions( $user_id );
$wp_login_manage_sessions->persistent_login_update_session( $session_verifier, null );
// set a new cookie with remember me checked
wp_set_auth_cookie( $user_id, true );
}
I want the plugin to remember the login, just like "Remember Me" option in standard login form.
The text was updated successfully, but these errors were encountered: