Closed (won't fix)
Project:
Adminmenu Dhtml
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
21 Feb 2007 at 20:46 UTC
Updated:
2 Feb 2013 at 21:18 UTC
Hi,
For what its worth, I love the admin menu! I wanted to remove links that the user ultimately cannot access... ie... dont show them if they cant access them.
This little patch works perfectly.. (for me), your mileage may vary.... its a bit hokey granted. ; )
function _admin_menu_get_children(&$admin_items, &$item) {
global $_menu;
global $user;
if (isset( $item['children'] )) {
foreach ($item['children'] as $child) {
// old line
// $is_visible_item = $_menu['items'][$child]['type'] & (MENU_VISIBLE_IN_TREE | MENU_IS_LOCAL_TASK);
// new line: remove entries which should not be viewable in the menu
$is_visible_item = ( $user->uid == 1 || $_menu['items'][$child]['access'] ) ? 1: 0;
// create the child item if it's visible in navigation
// Hide items linking to parent: && !($_menu['items'][$child]['type'] & MENU_LINKS_TO_PARENT) 12/01/2007 sun
if ($is_visible_item) {
$admin_items[$child] = $_menu['items'][$child];
// recurse to child menu items
if (isset( $_menu['items'][$child]['children'] )) {
_admin_menu_get_children($admin_items, $admin_items[$child]);
}
// remove this child item if it's visible in navigation
unset( $_menu['visible'][$child] );
}
else {
// remove child menu item from parent's children list
$parent_id = $_menu['items'][$child]['pid'];
$child_key = array_search($child, $_menu['items'][$parent_id]['children']);
if ($child_key !== FALSE) {
unset( $admin_items[$parent_id]['children'][$child_key] );
}
}
}
// sort remaining items
usort($item['children'], '_menu_sort');
}
}
Comments
Comment #1
simon georges commentedThis version of Adminmenu Dhtml is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.