user_roles

Versions
4.6 – 5
user_roles($membersonly = 0, $permission = 0)
6 – 7
user_roles($membersonly = FALSE, $permission = NULL)

▾ 4 functions call user_roles()

filter_admin_overview in modules/filter.module
Menu callback; allows administrators to set up input formats.
update_99 in database/updates.inc
upload_admin in modules/upload.module
user_edit_form in modules/user.module

Code

modules/user.module, line 1481

<?php
function user_roles($membersonly = 0, $permission = 0) {
  $roles = array();

  if ($permission) {
    $result = db_query("SELECT r.* FROM {role} r INNER JOIN {permission} p ON r.rid = p.rid WHERE p.perm LIKE '%%%s%%' ORDER BY r.name", $permission);
  }
  else {
    $result = db_query('SELECT * FROM {role} ORDER BY name');
  }
  while ($role = db_fetch_object($result)) {
    if (!$membersonly || ($membersonly && $role->name != 'anonymous user')) {
      $roles[$role->rid] = $role->name;
    }
  }
  return $roles;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.