My site login is via the "My Account" button on the header, which redirects to account.php. This login always return the user to the account.php page instead of the page where the user has just left. So, I started to look for a mod to change this behaviour and am glad to found this add-on. Thanks to the original author.

My mod below seems to work for me.

The way to prevent login page to return to itself (or other pages, like logoff, create_account, password_forgotten etc) but to the page where the user previously left, is to clear the snapshot on these pages. Without a snapshot, user is redirected to FILENAME_DEFAULT automatically upon login.

The following mod should work.


1) In includes/header.php:

Add on top of file,

_?php
// -- first any page other than login.php, set snapshot --
if (basename($PHP_SELF) != FILENAME_LOGIN) {
$navigation-_set_snapshot();
}
$origin_page = $navigation-_snapshot['page'];
// -- clear the snapshot for the following pages --
if (($origin_page = FILENAME_LOGOFF) or ($origin_page = FILENAME_CREATE_ACCOUNT) or ($origin_page = FILENAME_CREATE_ACCOUNT_SUCCESS) or ($origin_page = FILENAME_PASSWORD_FORGOTTEN)) {
$navigation-_clear_snapshot();
}
?_


2) If you activate the login.php through account.php, then it is necessary to remove the snapshot setting in account,php to prevent returning to itself again:

On line 16, change the line to or delete the line,

/* $navigation-_set_snapshot(); */


-------------------------------------
Note: No file is uploaded for this mod.

More...