https://www.icyphoenix.com/viewtopic.php?f=35&t=598&p=4895#p4895
-----------------------------------
moreteavicar
Sat 18 Nov, 2006 22:33

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):

[codeblock]
if ( $userdata['session_logged_in'] )
{
	$u_login_logout = LOGIN_MG . '?logout=true&amp;sid=' . $userdata['session_id'];
	$l_login_logout = $lang['Logout'] . ' (' . $userdata['username'] . ') ';
	$l_login_logout2 = $lang['Logout'];
[/codeblock]

After, add:

[codeblock]
//	$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 : '';
[/codeblock]
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!


