Restrict menu visibility to staff only.

Post

Posted
Rating:
#844 (In Topic #183)
Avatar
Standard member
Krahazik is in the usergroup ‘Fan in action’

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.
Online now: No Back to the top

Post

Posted
Rating:
#845
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
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


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#866
Avatar
Standard member
Krahazik is in the usergroup ‘Fan in action’
So far the only result was that the menuitem was not being displayed to any one, even admins could see it.
Online now: No Back to the top

Post

Posted
Rating:
#867
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
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.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top
1 guest and 0 members have just viewed this.
Back to Top