Logout


Subject: Logout
I have a small question.

Why whe I do logout the page that apper is the forum and not the home(portal).

Thank you in advance.
Claudio

Profile PM  
Subject: Re: Logout
There is a $smart_redirect on page_header for logout
But i don't know how to mod it for what you like :(

Subject: Re: Logout
Yes, the $smart_redirect isn't all that smart at the moment!

If you want to change where the user is redirected to, you need to insert some lines.

Open includes/page_header.php

Look for (around line 253):

Code: [Download] [Hide] [Select]
if ( $userdata['session_logged_in'] )
{
$u_login_logout = LOGIN_MG . '?logout=true&sid=' . $userdata['session_id'];
$l_login_logout = $lang['Logout'] . ' (' . $userdata['username'] . ') ';
$l_login_logout2 = $lang['Logout'];


After, add:

Code: [Download] [Hide] [Select]
// $smart_redirect = strrchr($_SERVER['PHP_SELF'], '/'); // uncomment these two lines if you want to return the user
// $smart_redirect = substr($smart_redirect, 1, strlen($smart_redirect)); // to the page they just viewed,
$smart_redirect = 'index.' . $phpEx; // and comment this line to prevent redirect to index page
$u_login_logout .= (!empty($smart_redirect)) ? '&redirect=' . $smart_redirect : '';

You see in the above, I have set it so you can decide whether to redirect to the index page (as it is at the moment), or, by commenting out that, and uncommenting the upper two lines, have it redirect to whatever page the user is viewing.

And note, these lines should be added before: } - the closure of the if statement!

Profile PM  
Subject: Re: Logout
Smart redirect is enabled only when logging in.

When logging out has been disabled, because if you are logging out from a page which requires special permissions you would be asked to login again.

So FORUM INDEX has been inserted as default.

moreteavicar, remember that INDEX.PHP in XS is identified by PORTAL_MG... so you should use that var. :wink:

Subject: Re: Logout
Well, I don't see how it really matters - There is no reason not to override a variable with a constant, such as "index.php" if you want to have everyone referred to that page by default - if it physically exists as a file in your root... And also, $_SERVER['PHP_SELF'] returns the real page name being used... so the real filename is implicit in the variables $portal_mg and $smart_redirect anyway... so whether you make $smart_redirect = $portal_mg or $smart_redirect = 'index.php' depends on if you are likely to change the name of index.php to home.php or whatever... which is not the case here... (and in any case, the intelligent person here will know to change index.php to home.php, etc). In fact I use the implementation posted above on my site so that users are referred to index.php on logging out, and it can also be simplified to:

Code: [Download] [Hide]
  1. $u_login_logout .= '&redirect=index.php';  

Profile PM  
Subject: Re: Logout
Of course you can avoid using the CONSTANT... but if you post a solution to the forum you should use the standard way XS is coded, otherwise some users may have problems if they have renamed their pages. :wink:

Remember also that & char should be escaped before being passed to an URL which has to be clicked... otherwise it is not W3C compliant... :wink:

Code: [Download] [Hide]
  1. $u_login_logout .= '&redirect=' . PORTAL_MG; 


This should be the correct code to be used in XS.


Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.3212s (PHP: 10% SQL: 90%)
SQL queries: 13 - Debug Off - GZIP Enabled