Home > php > DokuWiki: Redirect users on logout to front/start page

DokuWiki: Redirect users on logout to front/start page


I have a DokuWiki site for some documentation, and I needed to have it so that users who are logging off and then logging back in are always redirected to the home page. (DokuWiki, by default, redirects them to the page that they were on when the logged out.)

I was able to find the code to handle this in actions.php in the root of my Dokuwiki install. In that file, there is a function called function act_auth($act). In that function, look for this piece of code:

  //handle logout
  if($act=='logout'){

That’s the one that handles the action when users log out.

The last line of that control sequence is:

    act_redirect($ID,'login');

You just need to replace $ID with “”, and that redirects all users who are logging off to the front/home page. So when they log back in, they are on the start page.

New code:

    act_redirect("",'login');

Categories: php Tags:
  1. Gordon
    July 25, 2011 at 6:32 pm | #1

    Brilliant. Works a treat. Thanks for documenting this.

    • sumanrs
      July 29, 2011 at 11:20 am | #2

      Thanks! Glad you found it useful!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.