function user_access

cis7 user.module user_access($string, $account = NULL)
cle7 user.module user_access($string, $account = NULL)
elmsmedia7 user.module user_access($string, $account = NULL)
icor7 user.module user_access($string, $account = NULL)
meedjum_blog7 user.module user_access($string, $account = NULL)
mooc7 user.module user_access($string, $account = NULL)

Determine whether the user has a given privilege.


$string: The permission, such as "administer nodes", being checked for.

$account: (optional) The account to check, if not given use currently logged in user.

Return value

Boolean TRUE if the current user has the requested permission.

All permission checks in Drupal should go through this function. This way, we guarantee consistent behavior, and ensure that the superuser can perform all actions.

433 calls to user_access()
accessibility_content_field_attach_view_alter in sites/all/modules/ulmus/accessibility/modules/accessibility_content/accessibility_content.module
Implements hook_field_attach_view_alter().
accessibility_content_init in sites/all/modules/ulmus/accessibility/modules/accessibility_content/
accessibility_reporting_field_attach_view_alter in sites/all/modules/ulmus/accessibility/modules/accessibility_reporting/accessibility_reporting.module
Implements hook_field_attach_view_alter().
accessibility_test_access in sites/all/modules/ulmus/accessibility/accessibility.module
Access callback for accessibility test entities.
accessibility_theming_page_build in sites/all/modules/ulmus/accessibility/modules/accessibility_theming/accessibility_theming.module
Implements hook_init().

... See full list

37 string references to 'user_access'
advanced_help_menu_alter in sites/all/modules/ulmus/advanced_help/advanced_help.module
Implements hook_menu_alter().
context_ui_menu in sites/all/modules/ulmus/context/context_ui/context_ui.module
Implementation of hook_menu().
date_popup_menu in sites/all/modules/ulmus/date/date_popup/date_popup.module
Implements hook_menu().
devel_drupal_goto_alter in sites/all/modules/ulmus/devel/devel.module
Implements hook_drupal_goto_alter().
drupal-6.bare.database.php in modules/simpletest/tests/upgrade/drupal-6.bare.database.php
Bare installation of Drupal 6.17, for test purposes.

... See full list


modules/user/user.module, line 794
Enables the user registration and login system.


function user_access($string, $account = NULL) {
  global $user;

  if (!isset($account)) {
    $account = $user;

  // User #1 has all privileges:
  if ($account->uid == 1) {
    return TRUE;

  // To reduce the number of SQL queries, we cache the user's permissions
  // in a static variable.
  // Use the advanced drupal_static() pattern, since this is called very often.
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['perm'] = &drupal_static(__FUNCTION__);
  $perm = &$drupal_static_fast['perm'];
  if (!isset($perm[$account->uid])) {
    $role_permissions = user_role_permissions($account->roles);

    $perms = array();
    foreach ($role_permissions as $one_role) {
      $perms += $one_role;
    $perm[$account->uid] = $perms;

  return isset($perm[$account->uid][$string]);



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.