Created
January 9, 2012 11:56
-
-
Save opi/1582649 to your computer and use it in GitHub Desktop.
Drupal: Front theme on error 403 (Access denied)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// To enable this, set 403 path to 'error-403' on admin/settings/error-reporting | |
// or do variable_set('site_403', 'error-403'); in a hook_update_N, in your .install file. | |
function mymodule_menu() { | |
return array( | |
'error-403' => array( | |
'title' => "Access denied", | |
'page callback' => 'mymodule_error_403', | |
'access arguments' => array('access content'), | |
), | |
); | |
} | |
function mymodule_error_403() { | |
// Always display front theme | |
global $custom_theme; | |
$custom_theme = FALSE; | |
// Mimic default drupal 403 | |
drupal_set_title(t("Access denied")); | |
return t("You are not authorized to access this page."); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment