I was wondering if there is a function I can call to trigger the access denied message, basically override any other permissions that may exist.

Comments

msteudel’s picture

One work around I did on this was to add my code logic above the template, then overwrite the $content variable with something like:

$content = '<h3>Access Denied</h3>';

Sorta hacky, but it achieved the same effect.

MS

yasir farooqui’s picture

Drupal provides a function to trigger the access denied, the function is "drupal_access_denied", you can use this function in your code logic where needed.