Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.948 diff -u -r1.948 user.module --- modules/user/user.module 20 Dec 2008 18:24:41 -0000 1.948 +++ modules/user/user.module 22 Dec 2008 06:42:54 -0000 @@ -674,7 +674,7 @@ function user_user_form(&$edit, &$account, $category = NULL) { if ($category == 'account') { $form_state = array(); - return user_edit_form($form_state, arg(1), $edit); + return user_edit_form($form_state, (isset($account->uid) ? $account->uid : FALSE), $edit); } } @@ -683,7 +683,7 @@ */ function user_user_validate(&$edit, &$account, $category = NULL) { if ($category == 'account') { - return _user_edit_validate(arg(1), $edit); + return _user_edit_validate($account, $edit); } } @@ -692,7 +692,7 @@ */ function user_user_submit(&$edit, &$account, $category = NULL) { if ($category == 'account') { - return _user_edit_submit(arg(1), $edit); + return _user_edit_submit($account, $edit); } } @@ -1559,10 +1559,10 @@ return $form; } -function _user_edit_validate($uid, &$edit) { - $user = user_load(array('uid' => $uid)); +function _user_edit_validate($account, &$edit) { + $uid = isset($account->uid) ? $account->uid : FALSE; // Validate the username: - if (user_access('change own username') || user_access('administer users') || !$user->uid) { + if (user_access('change own username') || user_access('administer users') || !$uid) { if ($error = user_validate_name($edit['name'])) { form_set_error('name', $error); } @@ -1580,12 +1580,11 @@ } } -function _user_edit_submit($uid, &$edit) { - $user = user_load(array('uid' => $uid)); +function _user_edit_submit($account, &$edit) { // Delete picture if requested, and if no replacement picture was given. if (!empty($edit['picture_delete'])) { - if ($user->picture && file_exists($user->picture)) { - file_unmanaged_delete($user->picture); + if ($account->picture && file_exists($account->picture)) { + file_unmanaged_delete($account->picture); } $edit['picture'] = ''; }