From 3dddaa3e6ff47b52df5836a49272952893208ddc Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 18 Oct 2009 06:56:24 +0000 Subject: #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. --- modules/user/user.module | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/user/user.module') 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; -- cgit v1.2.3