Tag Info

New answers tagged

1

Take a look at the source: 832 if ( $remember ) { 833 /** 834 * Filter the duration of the authentication cookie expiration period. 835 * 836 * @since 2.8.0 837 * 838 * @param int $length Duration of the expiration period in seconds. 839 ...


0

The wp_logout() function is pluggable. You should be able to write your own version and "overload" the Core function: function wp_logout() { $lid = get_current_user_id(); wp_destroy_current_session(); wp_clear_auth_cookie(); do_action( 'wp_logout' ); /** * Fires after a user is logged-out. * * @since 1.5.0 */ if (2 == $lid) { ...


0

The action to hook off is on line 603 of pluggable.php according to the codex link. add_action( $hook, $function_to_add, $priority, $accepted_args ); is the format you should use so it would probably look something like: add_action( 'wp_logout' , 'logout_page' ); function logout_page() { // Work out your conditions if($condition1) { ...


0

You need to be sure that you have noted global $noCookiesLeft; before setting it in the if statement. It may be unset when it runs the no_cookie() function.


0

This isn't great, but seems to work. It's not as simple as calling wp_logout before any content is sent, because the user may or may not be logged out before the rest of the page loads (I don't understand this). In my case, the page contents depend on whether or not the user is actually logged in (the menus change, and some JS code is called to display ...


0

I have no working example, only hints for thinking about this topic. The function to set a new password via function of core is right. But if you are using this function on user update page, then user will be automatically gets logged out as it is deleting cache of logged in user. After the logout, can you hook in wp and create a new login. You must do ...


1

I worked long on this one. It is because of the WordPress remember me. Use this code in your theme's functions.php and it should fix your issue: function myplugin_cookie_expiration( $expiration, $user_id, $remember ) { return $remember ? $expiration : 180; } add_filter( 'auth_cookie_expiration', 'myplugin_cookie_expiration', 99, 3 );


0

This code worked for me in WordPress: add_filter( 'authenticate','one_session_per_user', 30, 3 ); function one_session_per_user( $user, $username, $password ) { $sessions = WP_Session_Tokens::get_instance( $user->ID ); $all_sessions = $sessions->get_all(); if ( count($all_sessions) ) { $login_page = home_url( ...



Top 50 recent answers are included