function user_user_login

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

Implements hook_user_login().

File

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

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.