By santanu mondal on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.4.x
Introduced in version:
11.4.0
Description:
user_load_by_mail() and user_load_by_name() are deprecated and will be removed in Drupal 13. Load User entities from storage by their properties instead.
Before:
$user = user_load_by_mail($mail);
After:
$users = \Drupal::entityTypeManager()->getStorage('user')->loadByProperties(['mail' => $mail]);
$user = reset($users);
Before:
$user = user_load_by_name($name);
After:
$users = \Drupal::entityTypeManager()->getStorage('user')->loadByProperties(['name' => $name]);
$user = reset($users);
Impacts:
Module developers