- This topic has 0 replies, 1 voice, and was last updated 1 year, 11 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › About logout qsm user
Hello.
Thank you for the great plugin.
I’m thinking of making my own since there is no function to control the number of simultaneous logins.
After researching, I found out that the WordPress logout process and the Simple Membership logout process are different.
Specifically, I tried to introduce logout on other devices with the following function. The function was executed, but other devices were not logged out.
add_action(‘wp_login’, function ($login, $user) {
// Destroy all user sessions
$user_sessions = WP_Session_Tokens::get_instance($user->ID);
$user_sessions->destroy_all();
// Set login cookie
wp_set_auth_cookie($user->ID, true);
}, 10, 2);
In other words, I think $user_sessions->destroy_all(); does not allow you to log out.
I tried other logout-related plugins, but couldn’t log out.
Can you tell me the process for logging out?