MyBB Community Forums

Full Version: Display a menu button for a few groups
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
Well, I have a forum and I would like to put a link in a menu that is visible only to certain groups, but I do not know how, and if it's possible .. ?

Thank you for your help.
(Sorry for my english, I'm french)
you can use template conditionals plugin and code like below
<if in_array($mybb->usergroup['gid'], array('X', 'Y', 'Z')) then>your link</if>
where X, Y, Z .. are group IDs which can see the link
I installed the plugin "PHP In Template" in my header and I put the following code
<if in_array($mybb-> usergroup ['gid'], array ('4 ')) then> <a href="mypage.php"> MyPage </ a> </ if>
And only the group of users who will be designated button visibility?

Okays it works! A big thank you!
A soon!
^ that link should be visible to only users of group id 4 (administrators)
This is my I just added to "in_array" an exclamation point and running.
Those who give my code:
<if !in_array($mybb-> usergroup ['gid'], array ('3 ')) then> <a href=""> MyText </a> </if>
^ so that link is not visible to user group 3 (super moderators - unless you changed groups) but it is visible to all other groups!
Yes that's right, but I found. Just add an exclamation point to in_array.