From 31faf303a6acabf69c788c08afb8d35abfbb563f Mon Sep 17 00:00:00 2001
From: salvis <db@salvisberg.com>
Date: Mon, 9 Apr 2012 18:30:02 +0200
Subject: [PATCH] Issue #1524438 by salvis: Redirect User|Edit page to User|View on submit.

---
 core/modules/locale/locale.test  |    1 +
 core/modules/user/user.pages.inc |    3 +++
 core/modules/user/user.test      |    4 ++++
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/core/modules/locale/locale.test b/core/modules/locale/locale.test
index f2395ad..f5f4539 100644
--- a/core/modules/locale/locale.test
+++ b/core/modules/locale/locale.test
@@ -1796,6 +1796,7 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase {
     $this->drupalPost($path, $edit, t('Save'));
     // Ensure form was submitted successfully.
     $this->assertText(t('The changes have been saved.'), t('Changes were saved.'));
+    $this->drupalGet($path);
     // Check if language was changed.
     $elements = $this->xpath('//input[@id=:id]', array(':id' => 'edit-preferred-langcode-' . $langcode));
     $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), t('Default language successfully updated.'));
diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc
index c54bd4c..f3ee01e 100644
--- a/core/modules/user/user.pages.inc
+++ b/core/modules/user/user.pages.inc
@@ -285,6 +285,9 @@ function user_profile_form_submit($form, &$form_state) {
   // Clear the page cache because pages can contain usernames and/or profile information:
   cache_clear_all();
 
+  // Redirect to User|View.
+  $form_state['redirect'] = 'user/' . $account->uid;
+
   drupal_set_message(t('The changes have been saved.'));
 }
 
diff --git a/core/modules/user/user.test b/core/modules/user/user.test
index 95b3cce..d470493 100644
--- a/core/modules/user/user.test
+++ b/core/modules/user/user.test
@@ -1811,6 +1811,7 @@ class UserSignatureTestCase extends DrupalWebTestCase {
     $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save'));
 
     // Verify that values were stored.
+    $this->drupalGet('user/' . $this->web_user->uid . '/edit');
     $this->assertFieldByName('signature[value]', $edit['signature[value]'], 'Submitted signature text found.');
     $this->assertFieldByName('signature[format]', $edit['signature[format]'], 'Submitted signature format found.');
 
@@ -2093,12 +2094,14 @@ class UserRolesAssignmentTestCase extends DrupalWebTestCase {
     // Assign the role to the user.
     $this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => $rid), t('Save'));
     $this->assertText(t('The changes have been saved.'));
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->assertFieldChecked('edit-roles-' . $rid, t('Role is assigned.'));
     $this->userLoadAndCheckRoleAssigned($account, $rid);
 
     // Remove the role from the user.
     $this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => FALSE), t('Save'));
     $this->assertText(t('The changes have been saved.'));
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->assertNoFieldChecked('edit-roles-' . $rid, t('Role is removed from user.'));
     $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
   }
@@ -2129,6 +2132,7 @@ class UserRolesAssignmentTestCase extends DrupalWebTestCase {
     // Remove the role again.
     $this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => FALSE), t('Save'));
     $this->assertText(t('The changes have been saved.'));
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->assertNoFieldChecked('edit-roles-' . $rid, t('Role is removed from user.'));
     $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
   }
-- 
1.7.4.msysgit.0

