22
April
User this code before
use Drupal\user\Entity\User;
Thise code will be return user list of a given role (editor)
$ids = \Drupal::entityQuery('user') ->condition('status', 1) ->condition('roles', 'editor') ->execute(); $users = User::loadMultiple($ids); foreach($users as $user){ $username = $user->get('name')->value; $uid = $user->get('uid')->value; $userlist[$uid] = $username; }
© 2023.ZedAngle. All Rights Reserved.