function user_user_login

Same name in other branches
  1. 9 core/modules/user/user.module \user_user_login()
  2. 10 core/modules/user/user.module \user_user_login()
  3. 11.x core/modules/user/user.module \user_user_login()

Implements hook_user_login().

File

core/modules/user/user.module, line 596

Code

function user_user_login(UserInterface $account) {
    // Reset static cache of default variables in template_preprocess() to reflect
    // the new user.
    drupal_static_reset('template_preprocess');
    // If the user has a NULL time zone, notify them to set a time zone.
    $config = \Drupal::config('system.date');
    if (!$account->getTimezone() && $config->get('timezone.user.configurable') && $config->get('timezone.user.warn')) {
        \Drupal::messenger()->addStatus(t('Configure your <a href=":user-edit">account time zone setting</a>.', [
            ':user-edit' => $account->toUrl('edit-form', [
                'query' => \Drupal::destination()->getAsArray(),
                'fragment' => 'edit-timezone',
            ])
                ->toString(),
        ]));
    }
}

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