I want to get the user id and role before the user is logged in. If i have the email or username, what function can I use with D8 to get the user id ?
Drupal 8 now also has these specific functions:
$user = user_load_by_name('some user'); $uid = $user->id();
$user = user_load_by_mail('firstname.lastname@example.org'); $uid = $user->id();