Restrict menu visibility to staff only.

Post

Posted
Rating:
#894 (In Topic #233)

Tempcode to limit who sees a particular menu my group affiliation.

I have a menu entry I am trying to restrict who can see the menu via tempcode and the Restrict link visibility  field. The brief help text just gives a sample code to prevent the menu from being displayed toguests, but I want to prevent the menu from being displayed from normal logge din members as well. I want ot restrict the menu so that only logged in users who are marked as staff or members of particular groups can see the menu. How would I do this?

I have tried searching the website and forums and so far I can not find any inormation about the menu system or details about that field and how to use tempcode with that particular field.

Post

Posted
Rating:
#895
Hi,

("prevent the menu"/"restrict the menu"/"can see the menu" - I'll assume you meant "prevent the menu item", as this is how you started the post and as you'd use a different technique to control viewing of the menu as a whole.)

You can do something like:
{$?,{$IS_IN_GROUP,4-8},,_never_}
I didn't test this but that should show it to anyone in groups 4-8.
Essentially any Tempcode should work as long as some nonsense is output for non-matching members (the nonsense being _never_ in this case.

More examples…

{$?,{$IS_IN_GROUP,4,7,8},,_never_}
For groups #4,7,8

{$?,{$IS_IN_GROUP,2},_never_,}
For everyone except group #2

Post

Posted
Rating:
#916
So far the only result was that the menuitem was not being displayed to any one, even admins could see it.

Post

Posted
Rating:
#917
Hi,

I think you meant to say "even admins couldn't see it".

For us to help you'd need to tell us the exact code used, the IDs of your usergroups, and the groups you tested with.
2 guests and 0 members have recently viewed this.