MyBB Community Forums

Full Version: Manually Logout a user with logoutkey?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I currently using this line of code to manually or force the user to log out.
$db->update_query("users", array("loginkey" => ""),"uid = '{$mybb->user['uid']}'");

It is working for logout. But this will remove the loginkey. Anyone knows how to do it?
actually logoutkey is used in the logout link - not directly related to database query.

see related logout fuctionality in member.php file which might help for your requirement

unset cookies mybbuser & sid should result in user logout
You could just generate a new loginkey for the user.

require_once(MYBB_ROOT . 'inc/functions_user.php');
update_loginkey($mybb->user['uid']);
Out of curiosity, why would anyone want's to force logout their member's without them knowing !

It's such an bad impressions from user's point of view..
^ well, it is a functionality required for a different purpose here - single sign on