function hook_user_login

Same name in other branches
  1. 9 core/modules/user/user.api.php \hook_user_login()
  2. 8.9.x core/modules/user/user.api.php \hook_user_login()
  3. 10 core/modules/user/user.api.php \hook_user_login()
  4. 11.x core/modules/user/user.api.php \hook_user_login()

The user just logged in.

Parameters

$form_state: A keyed array containing the current state of the login form.

$account: The user object on which the operation was just performed.

Related topics

4 functions implement hook_user_login()

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

openid_user_login in modules/openid/openid.module
Implements hook_user_login().
session_test_user_login in modules/simpletest/tests/session_test.module
Implements hook_user().
system_user_login in modules/system/system.module
Implements hook_user_login().
trigger_user_login in modules/trigger/trigger.module
Implements hook_user_login().
1 invocation of hook_user_login()
user_login_finalize in modules/user/user.module
Finalize the login process. Must be called when logging in a user.

File

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

Code

function hook_user_login(&$form_state, $account) {
    // If the user has a NULL time zone, notify them to set a time zone.
    if (!$account->timezone && variable_get('configurable_timezones', 1) && variable_get('empty_timezone_message', 0)) {
        drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array(
            '@user-edit' => url("user/{$account->uid}/edit", array(
                'query' => drupal_get_destination(),
                'fragment' => 'edit-timezone',
            )),
        )));
    }
}

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