This project is read-only.

Orchard.Experimental DebugShowAllMenuItems

Topics: Administration, Customizing Orchard, General, Troubleshooting
Mar 25, 2011 at 5:49 PM


I'm wanting to hide a menu item based on a users role. I see Orchard.Experimental, DebugShowAllMenuItems in the code. is there any way to use this to hide menu items?


Mar 25, 2011 at 6:13 PM
Edited Mar 25, 2011 at 6:14 PM

No - if you apply that permission then the user will get all *admin* menu items (i.e. the ones on the left in Dashboard view).

All dashboard menus are automatically hidden based on relevant user permissions. So if you take away a user's permission to edit blogs, for instance, they won't see the Blogs menu.

If you want to hide items in the main site menu however, you'll have to write code - there's no way in Navigation to specify roles. But you can create your own implementation of INavigationProvider, return "menu" for the MenuName, and specify a Permission when you return your custom menu item. I haven't tested this but it should work the same as the admin menu in this regard. See "AdminMenu.cs" which is in most modules, for examples of how to set menu Permissions.

However if you look at things a slightly different way, what you can do easily is show or hide Widget layers based on a user's role.

So you can add a Html Widget to any Zone, in the appropriate Layer for the Role you're targetting, and add whatever links you like as HTML in the widget.

Certainly roles-based menus would be a very useful feature to have. If you've looked at Piotr's Hierarchical Menu Module (, perhaps you could put in a request for that feature for a forthcoming version?