summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-18 06:56:24 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-18 06:56:24 +0000
commit3dddaa3e6ff47b52df5836a49272952893208ddc (patch)
tree2f3f069774f2f2091a0a169c6210fc356e2d057a /modules/user/user.module
parent1650fea5d949b576bcc779d6315250da0ba7ec82 (diff)
downloadbrdo-3dddaa3e6ff47b52df5836a49272952893208ddc.tar.gz
brdo-3dddaa3e6ff47b52df5836a49272952893208ddc.tar.bz2
#356074 by chx and Damien Tournoud: Provide a sequences API. Gets rid of stupid tables that only contain an incrementing ID, and fixes database import problems due to user ID 0.
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index fe75f1c7b..48140a862 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -448,6 +448,11 @@ function user_save($account, $edit = array(), $category = 'account') {
user_module_invoke('update', $edit, $user, $category);
}
else {
+ // Allow 'uid' to be set by the caller. There is no danger of writing an
+ // existing user as drupal_write_record will do an INSERT.
+ if (empty($edit['uid'])) {
+ $edit['uid'] = db_next_id(db_query('SELECT MAX(uid) FROM {users}')->fetchField());
+ }
// Allow 'created' to be set by the caller.
if (!isset($edit['created'])) {
$edit['created'] = REQUEST_TIME;