4.6.x common.inc drupal_access_denied()
4.7.x common.inc drupal_access_denied()
5.x common.inc drupal_access_denied()
6.x common.inc drupal_access_denied()
7.x common.inc drupal_access_denied()

Generates a 403 error if the request is not allowed.

11 calls to drupal_access_denied()
book_export_html in modules/book/book.module
This function is called by book_export() to generate HTML for export.
comment_edit in modules/comment/comment.module
file_download in includes/file.inc
index.php in ./index.php
The PHP page that serves all page requests on a Drupal installation.
node_revisions in modules/node/node.module
Menu callback for revisions related activities.

... See full list


includes/common.inc, line 386
Common functions that many Drupal modules will need to reference.


function drupal_access_denied() {
  drupal_set_header('HTTP/1.1 403 Forbidden');
  watchdog('access denied', check_plain($_GET['q']), WATCHDOG_WARNING);

  // Keep old path for reference
  if (!isset($_REQUEST['destination'])) {
    $_REQUEST['destination'] = $_GET['q'];

  $path = drupal_get_normal_path(variable_get('site_403', ''));
  if ($path && $path != $_GET['q']) {
    $return = menu_execute_active_handler();
  else {
    // Redirect to a non-existent menu item to make possible tabs disappear.

  if (empty($return) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) {
    drupal_set_title(t('Access denied'));
    $return = t('You are not authorized to access this page.');
  print theme('page', $return);