You are here

function user_user_presave in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/user.module \user_user_presave()
  2. 7 modules/user/user.module \user_user_presave()
  3. 9 core/modules/user/user.module \user_user_presave()

Implements hook_ENTITY_TYPE_presave() for user entities.

@todo https://www.drupal.org/project/drupal/issues/3112704 Move to \Drupal\user\Entity\User::preSave().

File

core/modules/user/user.module, line 157
Enables the user registration and login system.

Code

function user_user_presave(UserInterface $account) {
  $config = \Drupal::config('system.date');
  if ($config
    ->get('timezone.user.configurable') && !$account
    ->getTimeZone() && !$config
    ->get('timezone.user.default')) {
    $account->timezone = $config
      ->get('timezone.default');
  }
}