Auto logoff with redirect

4 posts by 2 authors in: Forums > CMS Builder
Last Post: March 30, 2017   (RSS)

Hi all,

I’ve got the membership plugin V1.10 active and am running CMSB 3.06.

After a member updates their profile I want to automatically  log them off and redirect them to a logoff page.

Based on a snippet of code I found in admin_functions.php, I included the following code in my member_profile page:

 // on success

$errorsAndAlerts = "Thanks, we've updated your profile!<br/>\n";

user_logoff();

redirectBrowserToURL("http://www.my_site.com/logout_index.php");

In the membership plugin, my $GLOBALS['WEBSITE_LOGIN_POST_LOGOFF_URL'] = 'http://my_site.com/logout_index.php';

I seem to be logged off, but am returned to the normal login page instead of logout_index.php

Any thoughts?

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Dave - March 30, 2017

Hi Jerry, 

user_logoff() is an internal CMSB function and takes an optional redirect url as an argument.  Try this: 

$errorsAndAlerts = "Thanks, we've updated your profile!<br/>\n";
user_logoff("http://www.my_site.com/logout_index.php");

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

Thanks Dave,

I'll give it a try...

Happy Spring!

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php