You are here

function users_by_access_ in Advanced User 7.3

@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 forms/advuser_settings.inc
@file
_advuser_dbquery_users_to_notify in ./advuser.module
@private Return a list of users to send notification of user changes.

File

./advuser.module, line 250
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) {
  $ret = array();
  $result = db_query("SELECT ur.uid from {role_permission} rp LEFT OUTER JOIN {users_roles} ur ON ur.rid = rp.rid WHERE rp.permission LIKE '%{$perm}%'");
  $result
    ->execute();
  foreach ($result as $data) {
    if (isset($data->uid)) {
      $ret[] = (int) $data->uid;
    }
  }
  if (!in_array(1, $ret, TRUE)) {
    if (variable_get('advuser_notify_uid1', FALSE)) {
      $ret[] = 1;
    }
  }
  return $ret;
}