I'm using the taxonomy_context module to display the blocks for on my site, but would like all of the terms under a certain taxononmy (category) only be seen by certain users. I thought the TAC_lite module would be able to do this, but unfortunantely it's not working for me. It seems to block all of the pages and the taxonomy_context menus show the categories, but never any pages (terms) under them. Have people had success using the TAC_lite with taxonomy_context? Should it work? If you are suing TAC_lite, are you doing menu display with any module or are you just manually managing your menus? Any help greatly appreciated.

Comments

Dave Cohen’s picture

The problem is that the menu system works independently of the node system. So the menu entries are created when the user creates the node, and from then on anyone can see the menu item. Right now its not possible to do anything about it, but this patch will make it possible: http://drupal.org/node/16542. Once committed I plan to update tac_lite.

JamieR’s picture

Having menu item visibility based on access to the node it's linking to is very important to me too. Thank you!

JamieR’s picture

Title: Taxonomy_context » Taxonomy_context / menu item visibility control

This hack did SEEMS to work... it's from user ninetwenty http://drupal.org/node/77414:

/**
* Determine whether the given menu item is accessible to the current user.
*
* Use this instead of just checking the "access" property of a menu item
* to properly handle items with fall-through semantics.
*/
function _menu_item_is_accessible($mid) {
$menu = menu_get_menu();

// Follow the path up to find the first "access" attribute.
$path = isset($menu['items'][$mid]['path']) ? $menu['items'][$mid]['path'] : NULL;
// ** Begin hack **
if (substr($path, 0, 5) == 'node/') {
$nid = substr($path, 5);
if (is_numeric($nid)) {
$node = node_load($nid);
return node_access('view', $node);
}
}
// ** End hack **
while ($path && (!isset($menu['path index'][$path]) || !isset($menu['items'][$menu['path index'][$path]]['access']))) {
$path = substr($path, 0, strrpos($path, '/'));
}
if (empty($path)) {
// Items without any access attribute up the chain are denied, unless they
// were created by the admin. They most likely point to non-Drupal directories
// or to an external URL and should be allowed.
return $menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN;
}
return $menu['items'][$menu['path index'][$path]]['access'];
}
Dave Cohen’s picture

Status: Active » Closed (won't fix)

I believe the menu system in drupal 5.x and up has solved this problem.