Create augmentative user id

email_registration.module

if (empty($names)) {
 $new_name = 'CUSTOM-NUMBER-FOR-USER-ID';
if ((bool) db_query("SELECT 1 FROM {users} WHERE uid <> :uid AND LOWER(name) = LOWER(:new_name)", array(':uid' => $account->uid, ':new_name' => $new_name))->fetchField()) {
  $name_idx = db_query_range("SELECT SUBSTRING_INDEX(name,'X',-1) FROM {users} WHERE name REGEXP :search ORDER BY CAST(SUBSTRING_INDEX(name,'X',-1) AS UNSIGNED) DESC", 0, 1, array(':search' => '^' . $new_name . '[0-9]+$'))->fetchField();
  $new_name .= sprintf('%010u',($name_idx + 1));
    }
  }

Posted in Drupal