Respond to creation of a new user account.
Note that when this hook is invoked, the changes have not yet been written to the database, because a database transaction is still in progress. The transaction is not finalized until the insert operation is entirely completed and \Drupal\user\DataStorageController::save() goes out of scope. You should not rely on data in the database at this time as it is not updated yet. You should also note that any write/update database queries executed from this hook are also not committed immediately. Check \Drupal\user\DataStorageController::save() and db_transaction() for more info.
$account: The user account object.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_user_insert($account) {
db_insert('user_changes')
->fields(array(
'uid' => $account->uid,
'created' => time(),
))
->execute();
}