drupal 8 user_load
The user_load
function in Drupal 8 is used to load a user entity by its ID. It takes the user ID as an argument and returns the corresponding user entity object. Here's an example of how to use the user_load
function:
$user = user_load($uid);
In the above example, $uid
is the ID of the user you want to load. The user_load
function will return the user entity object for that ID.
Please note that the user_load
function is deprecated in Drupal 8 and has been replaced by the User::load
method. It is recommended to use the User::load
method instead. Here's an example of how to use the User::load
method:
$user = \Drupal\user\Entity\User::load($uid);
In the above example, $uid
is the ID of the user you want to load. The User::load
method will return the user entity object for that ID.