MyBB Community Forums

Full Version: Hide Header Link to certain user group
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Would this be suitable for hiding a link in my template header to a particular user group?

if(!in_array($mybb->user['usergroup'], array('7'))) {

//Show Link
}
else{

//Hide Link

}
Would that do the trick? Do i need another plugin to allow php in templates? And one final question, what would the code be to hide the link, just blank, or...?
Here is a plugin to enable PHP in templates.

Then, simply:
<if in_array($GLOBALS['mybb']->user['usergroup'], array(7,1,4)) then> 
<a href="#">LINK</a></if>
See what I would do is look at the admin and mod cp links to see the code they used in the template, then do something similar
Or I could be wrong.... ? XD
Weboutfit, that is brilliant help thanks, but the PHP code isn't working for me?

I want to exclude group 5 and 6 from seeing the link.
(2011-12-08, 08:37 PM)david42 Wrote: [ -> ]Weboutfit, that is brilliant help thanks, but the PHP code isn't working for me?

I want to exclude group 5 and 6 from seeing the link.

<if !in_array($GLOBALS['mybb']->user['usergroup'], array(5,6)) then> 
//Whatever is in here will be not visible for groups with id 5 and 6
</if>
Thanks Omar, but there is a problem. No code i have been using seems to work. Your code above for example just shows the link to everyone.

I've tried it for different groups and still doesnt work, it either hides the link to everyone, or shows the link to everyone.
<if !in_array($GLOBALS['mybb']->user['usergroup'], array(5)) then><a href="http://www.berlingoforum.co.uk/donate.php"><img src="http://i.imgur.com/NWhnR.png" alt="" title="" /> Donate</a></if>
Try this:
<if $mybb->user['usergroup'] != '5' || $mybb->user['usergroup'] != '6' then> 
//Whatever is in here will be not visible for groups with id 5 and 6
</if>
Damn, now it is just hiding it to everyone! I wonder what is wrong.
Sorry, try it again.
Thanks again, must be a problem my end, because now it is just showing the link to everyone.
Pages: 1 2 3