WebsiteMembership redirect on logoff not working as expected

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: May 6, 2022   (RSS)

By pgplast - May 5, 2022

I am building an application on top of CMSB and have encountered a problem.

I am using WebsiteMembership plugin and have set

$GLOBALS['WEBSITE_LOGIN_POST_LOGOFF_URL'] =‘ /index.php’ (a page not requiring login)

My internal pages are protected by the plugin and the code of those pages uses some $SESSION variables to keep track of things happening in the app.

When a user logs off from one of the internal pages, however, instead of being redirected to /index.php, he is taken to the current url and an error is generated because the page code can no longer access $_SESSION variable values.

The _websiteLogin_logoff() function has :

$logoffUrl = coalesce(@$_SERVER['HTTP_REFERER'], $GLOBALS['WEBSITE_LOGIN_POST_LOGOFF_URL'], $currentPageUrl, '/');

and so the redirect should be going to my index.php page before looking further to $currentPageUrl.

Hence, I don’t understand this behavior.

Can you tell me what might be going on?

Thanks.

By pgplast - May 6, 2022

Thanks Daniel. Your solutions work, and I had already employed your "Plan B."

However, I was worried that I was overlooking something in the setup of the plugin that would take care of this scenario itself.

Thanks again for your prompt assist!