summaryrefslogtreecommitdiff
path: root/modules/user/user.pages.inc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user/user.pages.inc')
-rw-r--r--modules/user/user.pages.inc8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc
index 4c4a02971..e069f7fd7 100644
--- a/modules/user/user.pages.inc
+++ b/modules/user/user.pages.inc
@@ -302,13 +302,19 @@ function user_profile_form_submit($form, &$form_state) {
// Remove unneeded values.
form_state_values_clean($form_state);
+ // Before updating the account entity, keep an unchanged copy for use with
+ // user_save() later. This is necessary for modules implementing the user
+ // hooks to be able to react on changes by comparing the values of $account
+ // and $edit.
+ $account_unchanged = clone $account;
+
entity_form_submit_build_entity('user', $account, $form, $form_state);
// Populate $edit with the properties of $account, which have been edited on
// this form by taking over all values, which appear in the form values too.
$edit = array_intersect_key((array) $account, $form_state['values']);
- user_save($account, $edit, $category);
+ user_save($account_unchanged, $edit, $category);
$form_state['values']['uid'] = $account->uid;
if ($category == 'account' && !empty($edit['pass'])) {