views:

130

answers:

1

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.

A: 

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.

BrianV
yeah. I figured out another way around it, using hook_nodeapi() when $op == 'load'
Rosarch