开发者

Forbidden node still displays in the menu - how do I prevent this?

开发者 https://www.devze.com 2023-02-13 15:08 出处:网络
I\'ve implemented hook_menu_alter to add a custom access function to the standard node/%node menu item in Drupal 6.

I've implemented hook_menu_alter to add a custom access function to the standard node/%node menu item in Drupal 6.

function amh_w开发者_如何学运维orkflow_menu_alter(&$items)
{
  $items['node/%node']['access callback'] = '_amh_workflow_access';
}

This function works great for determining access when the node itself is displayed to the user - but the menu item for the node is always on display. I would like to have the menu item only display for the user when they have access to the page.

I have tried clearing out the cache a few times, but the menu item stubbornly refuses to hide. This seems really weird, as the other menu items (admittedly, I think they are all using the default user_access and simple access arguments) are all correctly hidden or displayed according to the users' privileges.

I don't understand why the node itself is being protected correctly, but not the menu item. It doesn't seem to me that the access callback is called when displaying the menu (debug messages in the callback method are not displaying).


This is the wrong way to deal with node access.

http://api.drupal.org/api/drupal/modules--node--node.module/group/node_access/6

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号