Login!
Lost password?
 

MODx Bug/Feature Tracker and Feature Requests

Welcome to the MODx CMS Tracker. Please choose the appropriate project from the drop down menu and provide as much information as possible regarding your server environment and browser. Thanks!

FS#548 — WebLogin logout doesn't preserve current url

Attached to Project — MODx
Opened by Armand Pondman (bS) - Monday, 02 October 2006, 06:09PM
Last edited by Jason Coward (opengeek) - Wednesday, 31 January 2007, 06:16PM
Task Type Bug Report
Category Core Distribution
Status Closed
Assigned To Jason Coward (opengeek)
Operating System All
Severity Medium
Priority Normal
Reported Version 0.9.2/0.9.2.1
Due in Version 0.9.6
Due Date Undecided
Percent Complete 100%

Details

When you logout using the link supplied by the WebLogin snippet you are logged out to the page you were visiting, however if that page contained some extra querystring parameters (other than id) these values disappear.

In some cases where snippets display different things depending on the querystring you are returned to a crippled page.
This task depends upon

This task blocks these from closing
Closed by  Garry Nutting (garryn)
Sunday, 28 September 2008, 12:13PM
Reason for closing:  Implemented
Additional comments about closing:  Implemented in SVN rev #4188
Comment by Armand Pondman (bS) - Monday, 02 October 2006, 06:33PM
weblogin.inc.php, line 115 needs to be changed into something that remembers the current querystring.

I use this function in my other projects which will do the trick:

function preserveUrl($docid = '', $alias = '', $array_values = array(), $suffix = false) {
global $modx;
$array_get = $_GET;
$urlstring = array();

unset($array_get["id"]);
unset($array_get["q"]);

$array_url = array_merge($array_get, $array_values);
foreach ($array_url as $name => $value) {
if (!is_null($value)) {
$urlstring[] = $name . '=' . urlencode($value);
}
}

$url = join('&',$urlstring);
if ($suffix) {
if (empty($url)) { $url = "?"; }
else { $url .= "&"; }
}

return $modx->makeUrl($docid, $alias, $url);
}