function hook_user_insert

A user account was created.

The module should save its custom additions to the user object into the database.

Parameters

$edit: The array of form values submitted by the user.

$account: The user object on which the operation is being performed.

$category: The active category of user information being edited.

See also

hook_user_presave()

hook_user_update()

Related topics

4 functions implement hook_user_insert()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_crud_hook_test_user_insert in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_user_insert().
openid_user_insert in modules/openid/openid.module
Implements hook_user_insert().
profile_user_insert in modules/profile/profile.module
Implements hook_user_insert().
trigger_user_insert in modules/trigger/trigger.module
Implements hook_user_insert().
1 invocation of hook_user_insert()
user_save in modules/user/user.module
Save changes to a user account or add a new user.

File

modules/user/user.api.php, line 268

Code

function hook_user_insert(&$edit, $account, $category) {
    db_insert('mytable')->fields(array(
        'myfield' => $edit['myfield'],
        'uid' => $account->uid,
    ))
        ->execute();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.