[development] Using drupal_access_denied()

Lee Rowlands leerowlands at rowlands-bcs.com
Tue Mar 23 12:27:08 UTC 2010


Hi,
By the time you get to preprocess_page it's probably too late for
drupal_access_denied, for the same reasons as drupal_add_js doesn't work in
preprocess_page functions (see
http://www.drupaler.co.uk/blog/joys-preprocessing/70), perhaps you might
need to use hook_menu_alter instead and override the access callback?
Lee

>If I do:
>
>function mymodule_preprocess_page(&$vars) {
>  if ($some_condition) {
>    drupal_access_denied();
>    exit;
>  }
>}
>
>I just get a white page (which is a 403 page looking at the header, not a
500).



More information about the development mailing list