Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Forum Module

Discuss the Forum Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Changing logout page on Forum


Reply

3 Posts   2391 Views

Avatar
mschiefmaker

1 October 2009 at 9:12pm Community Member, 187 Posts

I want the browser to go to a non-standard login page after a user has logged out but I am not sure how to get this to work. The logout function

function logout() {
      if($member = Member::currentUser())
         $member->logOut();
      $returnTo = DataObject::get_one("ForumHolder");
      if($returnTo)
         return Director::redirect(Director::absoluteBaseURL().$returnTo->URLSegment);
      else {
         return Director::redirectBack();
      }
   }

Uses a $returnTo Variable, where do I change this?

Thanks

MM

Avatar
Nivanka

3 October 2009 at 4:24am Community Member, 395 Posts

You can do this easily, Extend your Page class and create a new page type; So lets say this page type is LoggedOutPage.

Now what you have to do is that to rewrite the logout function.

function logout() {
if($member = Member::currentUser())
$member->logOut();
$returnTo = DataObject::get_one("LoggedOutPage");
if($returnTo)
return Director::redirect(Director::absoluteBaseURL().$returnTo->URLSegment);
else {
return Director::redirectBack();
}
}

this way you can redirect the users to any page. but make sure you prevent editing the core codes. otherwise when updating the modules, cms or the framework you will miss the cstomizations you did.

Avatar
mschiefmaker

4 October 2009 at 1:28pm Community Member, 187 Posts

Feeling kind of stupid. I just did not see that line. Thanks
MM