Skip to content
Snippets Groups Projects
Commit 739cc985 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #745668 by catch: remove pointless user_load() from user_save().

parent 210ccc49
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment