Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout Does Not Clear Logged-in User From Transient #97

Open
fluxism opened this issue Jun 10, 2020 · 0 comments
Open

Logout Does Not Clear Logged-in User From Transient #97

fluxism opened this issue Jun 10, 2020 · 0 comments

Comments

@fluxism
Copy link

fluxism commented Jun 10, 2020

The function sucuriscan_unset_online_user_on_logout hooks wp_logout in order to remove the logged-in user from the online_users transient.
https://github.com/Sucuri/sucuri-wordpress-plugin/blob/master/src/lastlogins-loggedin.php#L129

However that function searches for the user by:

$current_user = wp_get_current_user();
$user_id = $current_user->ID;

This always returns 0, as the wp_logout hook fires after setting user_id to 0.

Consequently, a user logout never succeeds in clearing the user from the list of online users.

A fix is to hook clear_auth_cookie instead of wp_logout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant