summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-11-18 14:59:16 +0000
committerDries Buytaert <dries@buytaert.net>2008-11-18 14:59:16 +0000
commit33905692957eb1cce0451a52ef9a6e8061c7dd83 (patch)
treed19bb0a28308d3eed00b5fbfbd3013166833bbd4 /modules/user/user.module
parentccd16b82a6ad62f3e2b00ca47e448be5571073fa (diff)
downloadbrdo-33905692957eb1cce0451a52ef9a6e8061c7dd83.tar.gz
brdo-33905692957eb1cce0451a52ef9a6e8061c7dd83.tar.bz2
- Patch #334671 by Steve Dondley: users cannot be assigned to roles or removed from them -- comes with tests. Yay.
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module29
1 files changed, 3 insertions, 26 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index f1a8593b7..50bf43fdd 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -139,9 +139,6 @@ function user_external_login($account, $edit = array()) {
* An associative array of attributes to search for in selecting the
* user, such as user name or e-mail address.
*
- * @return
- * A fully-loaded $user object upon successful user load or FALSE if user
- * cannot be loaded.
*/
function user_load($array = array()) {
// Dynamically compose a SQL query:
@@ -212,7 +209,7 @@ function user_load($array = array()) {
* (optional) The category for storing profile information in.
*
* @return
- * A fully-loaded $user object upon successful save or FALSE if the save failed.
+ * A fully-loaded $user object.
*/
function user_save($account, $edit = array(), $category = 'account') {
$table = drupal_get_schema('users');
@@ -256,11 +253,7 @@ function user_save($account, $edit = array(), $category = 'account') {
$edit['data'] = $data;
$edit['uid'] = $account->uid;
// Save changes to the users table.
- $success = drupal_write_record('users', $edit, 'uid');
- if (!$success) {
- // The query failed - better to abort the save than risk further data loss.
- return FALSE;
- }
+ drupal_write_record('users', $edit, 'uid');
// Reload user roles if provided.
if (isset($edit['roles']) && is_array($edit['roles'])) {
@@ -308,12 +301,7 @@ function user_save($account, $edit = array(), $category = 'account') {
$edit['access'] = REQUEST_TIME;
}
- $success = drupal_write_record('users', $edit);
- if (!$success) {
- // On a failed INSERT some other existing user's uid may be returned.
- // We must abort to avoid overwriting their account.
- return FALSE;
- }
+ drupal_write_record('users', $edit);
// Build the initial user object.
$user = user_load(array('uid' => $edit['uid']));
@@ -1413,11 +1401,6 @@ function user_external_login_register($name, $module) {
'access' => REQUEST_TIME
);
$account = user_save('', $userinfo);
- // Terminate if an error occured during user_save().
- if (!$account) {
- drupal_set_message(t("Error saving user account."), 'error');
- return;
- }
user_set_authmaps($account, array("authname_$module" => $name));
$user = $account;
watchdog('user', 'New external user: %name using module %module.', array('%name' => $name, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $user->uid . '/edit'));
@@ -2287,12 +2270,6 @@ function user_register_submit($form, &$form_state) {
$merge_data['status'] = variable_get('user_register', 1) == 1;
}
$account = user_save('', array_merge($form_state['values'], $merge_data));
- // Terminate if an error occured during user_save().
- if (!$account) {
- drupal_set_message(t("Error saving user account."), 'error');
- $form_state['redirect'] = '';
- return;
- }
$form_state['user'] = $account;
watchdog('user', 'New user: %name (%email).', array('%name' => $name, '%email' => $mail), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $account->uid . '/edit'));