Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
What is the preferred way of programmatically generating a list of users with a certain role?
(I know how to do it with a database query, but surely there's a higher-level method.)
In Drupal 7, user_load_multiple($uids = array(), $conditions = array(), $reset = FALSE)
will load the user details for the given user IDs.
In Drupal 6, there isn't that function, but you can use $user = user_load(array('uid' => $node->uid));.
user_load_multiple($uids = array(), $conditions = array(), $reset = FALSE)
$user = user_load(array('uid' => $node->uid));
SELECT u.* FROM users u,role r, users_roles ur WHERE r.name="authenticated user" AND r.rid=ur.rid AND ur.uid=u.uid;
try this query.
Umm? Create a view of type USER, filter on USER ROLE, and have field USER NAME?
Required, but never shown