You are here

function users_by_access in Advanced User 6.3

Same name and namespace in other branches
  1. 5.2 advuser.module \users_by_access()
  2. 6.2 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 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 314
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[] = (int) $data->uid;
    }
  }
  if (!in_array(1, $ret, TRUE)) {
    if (variable_get('advuser_notify_uid1', FALSE)) {
      $ret[] = 1;
    }
  }
  return $ret;
}