How to hide menu from anonymous users

Not sure how to approach this one.  I have a number of horizontal menu tabs and wish some of them to be only visible to certain user roles.  Anonymous users should not be able to see any of the menu items but admin user roles should see them all.

Is this easily done or can it only be done by having different menu blocks for each role?



Hi Christopher,

You can wrap the menu entries that you can to hide in a if. and use the CheckRegisteredRole(<Userid>) action to check if the user is registered.

Instead of only checking if its registered you can even check if the user has a role. using the same kind of actions that are inside the roles you created.



Thank you.  You say "wrap the menu entries that you can to hide in a if."  Exactly where do you wrap them?  Is this in the menu block as a whole or as individual elements within the menu block.

Hello Christopher, 

Inside the menu block you will find so. É "DropDownMenu" blocks. In general, you have one of these for each first level menu.

If you want to show a first level menu only for certain roles, wrap the DropDownMenu in an If widget and define the condition of the so that when the page (and the menu Web block) is built, this menu item appear only if the condition is satisfied. 

In this case, you can use the Check<RoleName>Role function to check if the logged user has this role.

 If you have a second level menu (sub menus) You can do the same thing, wrapping the link of a submenu item in an If. 


Great, thanks, I will try this in the morning and get back to you if I need more help.

Regards,  Chris.