diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-03-24 10:13:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-03-24 10:13:26 +0000 |
commit | 739cc9851f51c31af3c29d317ea733b0ada54907 (patch) | |
tree | 7280c12a448ab892bfe254840a91fe5d641d274b /modules/user/user.module | |
parent | 210ccc493f6c30fe280cd9c4e0f78dc0b055c06e (diff) | |
download | brdo-739cc9851f51c31af3c29d317ea733b0ada54907.tar.gz brdo-739cc9851f51c31af3c29d317ea733b0ada54907.tar.bz2 |
- Patch #745668 by catch: remove pointless user_load() from user_save().
Diffstat (limited to 'modules/user/user.module')
-rw-r--r-- | modules/user/user.module | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/modules/user/user.module b/modules/user/user.module index 2aa246e3b..7057a0b94 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -375,10 +375,7 @@ function user_save($account, $edit = array(), $category = 'account') { // Prepopulate $edit['data'] with the current value of $account->data. // Modules can add to or remove from this array in hook_user_presave(). if (!empty($account->data)) { - $data = unserialize($account->data); - foreach ($data as $key => $value) { - $edit['data'][$key] = $value; - } + $edit['data'] = !empty($edit['data']) ? array_merge($edit['data'], $account->data) : $account->data; } user_module_invoke('presave', $edit, $account, $category); @@ -500,11 +497,11 @@ function user_save($account, $edit = array(), $category = 'account') { return FALSE; } - // Build the initial user object. - $user = user_load($edit['uid'], TRUE); + // Build a stub user object. + $user = (object) $edit; + $user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; - $entity = (object) $edit; - field_attach_insert('user', $entity); + field_attach_insert('user', $user); user_module_invoke('insert', $edit, $user, $category); entity_invoke('insert', 'user', $user); @@ -522,9 +519,6 @@ function user_save($account, $edit = array(), $category = 'account') { } $query->execute(); } - - // Build the finished user object. - $user = user_load($edit['uid'], TRUE); } return $user; |