/** * Implements hook_user_login(). */ function {{ machine_name }}_user_login(UserInterface $account) { $config = \Drupal::config('system.date'); // If the user has a NULL time zone, notify them to set a time zone. if (!$account->getTimezone() && $config->get('timezone.user.configurable') && $config->get('timezone.user.warn')) { \Drupal::messenger() ->addStatus(t('Configure your account time zone setting.', [ ':user-edit' => $account->url('edit-form', [ 'query' => \Drupal::destination() ->getAsArray(), 'fragment' => 'edit-timezone', ]), ])); } }