You are here

function users_by_access in Advanced User 6.2

Same name and namespace in other branches
  1. 5.2 advuser.module \users_by_access()
  2. 6.3 advuser.module \users_by_access()

@public List of users for given roles

Parameters

string $perm // The string permission.:

Return value

array // An array of uid.

2 calls to users_by_access()
advuser_settings in ./advuser.module
advuser settings page
_advuser_dbquery_users_to_notify in ./advuser.module
@private Return a list of users to send notification of user changes.

File

./advuser.module, line 622
Advanced user module allows you to select users based on an advanced set of filtering and apply actions to block, unblock, delete or email the selected users.

Code

function users_by_access($perm) {
  $select_permissions = "SELECT ur.uid FROM {permission} p LEFT JOIN {users_roles} ur ON ur.rid = p.rid WHERE p.perm like '%%%s%%'";
  $ret = array();
  $result = db_query($select_permissions, $perm);
  while ($data = db_fetch_object($result)) {
    if (isset($data->uid)) {
      $ret[] = $data->uid;
    }
  }
  return $ret;
}