1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-02 00:45:03 +02:00

User settings page - redirect after successful update if user_name changed (prevent page not found when SEF url containing user_name is used).

This commit is contained in:
secretr 2011-11-28 09:14:51 +00:00
parent c8de603e62
commit ed9f06c50f
2 changed files with 15 additions and 2 deletions

View File

@ -314,7 +314,7 @@ class redirection
{
e107::getSession()->end();
}
if(NULL == $http_response_code)
if(null === $http_response_code)
{
header('Location: '.$url, $replace);
}

View File

@ -560,7 +560,18 @@ if ($dataToSave && !$promptPassword)
} // End - if (!$error)...
if (!$error && !$promptPassword) { unset($_POST); }
if (!$error && !$promptPassword)
{
if(isset($_POST) && $changedUserData['user_name'])
{
$redirect = e107::getRedirect();
$url = e107::getUrl();
$to = $_uid ? $url->create('user/profile/edit', array('id' => $_uid, 'name' => $changedUserData['user_name'])) : $url->create('user/myprofile/edit');
if($message) e107::getMessage()->addSuccess($message, 'default', true);
$redirect->redirect($to);
}
unset($_POST);
}
if ($error)
@ -585,6 +596,8 @@ if ($error)
// --- User data has been updated here if appropriate ---
$testSessionMessage = e107::getMessage()->get(E_MESSAGE_SUCCESS, 'default', true); // only success in the session
if($testSessionMessage) $message = implode('<br />', $testSessionMessage); // we got raw message - array
if (isset($message))
{
$ns->tablerender($caption, $message);