Answers for "drupal 8 load a user"

0

drupal 8 get user

$current_user = \Drupal::currentUser();
$user = \Drupal\user\Entity\User::load($current_user->id());

// or just
$user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
Posted by: Guest on October-04-2020
0

drupal 8 user_load

function user_load($uid, $reset = FALSE) {
  if ($reset) {
    \Drupal::entityManager()
      ->getStorage('user')
      ->resetCache(array(
      $uid,
    ));
  }
  return User::load($uid);
}
Posted by: Guest on May-11-2020

Browse Popular Code Answers by Language