You are here

function og_get_users_by_roles in Organic groups 7

Get all the users with certain roles in a group.

Parameters

$gid: The group unique ID.

$roles: Array with the role IDs to query.

File

./og.module, line 2573
Enable users to create and manage groups with roles and permissions.

Code

function og_get_users_by_roles($gid, $rids = array()) {
  $query = db_select('og_users_roles', 'og_users_roles');
  return $query
    ->fields('og_users_roles', array(
    'uid',
  ))
    ->condition('gid', $gid)
    ->condition('rid', $rids, 'IN')
    ->execute()
    ->fetchAll();
}