By halloffame on
How can we add a default starting number when user signs up? We have this -- site.com/user/uid. We usually have the uid of 1 for the first user, 2 for the second, and so on. What if we want to start say at 1001 then go from there? This includes the first admin account that was already created upon installation.
Do we need to hack in core? Create the first 1000 users manually (good grief! lol)? Any module?
Comments
Drupal assigns UIDs
Drupal assigns UIDs sequentially from the highest UID it finds in the USER table, so it's easy - create a user and manually (e.g. via phpMyAdmin) change the UID in the table to 999. The next user created will have UID 1000. I think ...
Seán
Note that uid 0 and 1 are
Note that uid 0 and 1 are special and both are created when you install Drupal.
It's a sequence (v5.x)
The current UID is stored in the sequences table; when a new user is created, db_next_id is called, which (for MySQL on v5.x) looks like:
function db_next_id($name) {
$name = db_prefix_tables($name);
db_query('LOCK TABLES {sequences} WRITE');
$id = db_result(db_query("SELECT id FROM {sequences} WHERE name = '%s'", $name)) + 1;
db_query("REPLACE INTO {sequences} VALUES ('%s', %d)", $name, $id);
db_query('UNLOCK TABLES');
return $id;
}
To adjust the next available UID to 1001: update sequences set id = 1001 where name = 'users_uid';