
Jason
Staff
/ Moderator

Jun 14, 2011, 10:22 AM
Post #2 of 4
(1080 views)
Shortcut
|
|
Re: [pothompson] Website Membership - Logoff
[In reply to]
|
Can't Post
|
|
Hi, You're right, the logoff functions do completely erase the $_SESSION array. There are a couple of function calls within the plugin that will trigger this: - user_logoff() - user_eraseLoginSession() What you can do is customize your plugin code to not use these functions. Instead you can set the $CURRENT_USER array to false and empty the username and passwordHash $_SESSION elements your self. For example:
// remove login cookies function _websiteLogin_logoff() { global $CURRNET_USER; // get logoff url if ($GLOBALS['WEBSITE_LOGIN_POST_LOGOFF_URL']) { $logoffUrl = $GLOBALS['WEBSITE_LOGIN_POST_LOGOFF_URL']; } else { $logoffUrl = thisPageUrl(); $logoffUrl = preg_replace('/\baction=logoff\b/', '', $logoffUrl); // prevent redirect loop } // logoff and redirect //user_logoff($logoffUrl); $CURRNET_USER = false; $_SESSION['username'] = ""; $_SESSION['passwordHash'] = ""; redirectBrowserToURL($logoffUrl); exit; } There are some important things to note here: 1) In every function that you do this in, you need the code global $CURRENT_USER; at the top in order to be able to access the $CURRENT_USER variable. 2)This customization is untested and may cause other problems. It might be a good idea to see if you can customize your other code to not use the $_SESSION array. Hope this helps. --------------------------------------------------- Jason Sauchuk - Programmer interactivetools.com Hire me! Save time by getting our experts to help with your project. http://www.interactivetools.com/consulting/
|