[development] How to trigger access denied page from hook_nodeapi

Pierre R. pierre.rineau at makina-corpus.com
Tue Jan 26 16:45:43 UTC 2010

On Tue, 2010-01-26 at 17:42 +0100, Ernst Plüss wrote:
> Hi Drupal friends
> I'd like to trigger a access denied page from my hook_nodeapi function
> up on $op=view.
> I already tried:
> unset($node->content);
> drupal_access_denied();
> This gives me a strange result: two access denied pages after each
> other.
> Thanks for giving me a hand!
> Best Regards
> Ernst

You'd better use hook_menu_alter() replace the 'access callback' with a
custom access function for the 'node/%' menu entry.

Your custom access function will do your custom tests, and if they are
OK then return the node_access() function result.


More information about the development mailing list