Search code examples
drupal-6http-status-code-403

Drupal6: Accessing node info from hook_preprocess_page(&$vars)


For a certain content type, I want to alter the access denied error message. What is the best way to go about doing this?

function mytheme_preprocess_page(&$vars) {

  if ($vars['title'] == 'Access denied' && $node->type == 'ODP') {
    $vars['content'] = 'OMG WHAT R U DOING!1!?!!1';
  }

I was hoping to do something like that. However, after a print_r(get_defined_vars()), I was unable to find anything that could help me figure out what type the node being displayed is.


Solution

  • I don't think that this can be done - an access denied message in Drupal is generated by calling drupal_access_denied(). If you read the linked API entry, you will see that it doesn't pass any information about what type of page was being visited.