Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved Hide Header Link to certain user group
#1
Not Solved
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...?
[Image: mybbsig.php]
#2
Not Solved
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>
#3
Not Solved
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
-ToJ
[Image: 25175.png]
#4
Not Solved
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.
[Image: mybbsig.php]
#5
Not Solved
(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>
#6
Not Solved
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>
[Image: mybbsig.php]
#7
Not Solved
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>
#8
Not Solved
Damn, now it is just hiding it to everyone! I wonder what is wrong.
[Image: mybbsig.php]
#9
Not Solved
Sorry, try it again.
#10
Not Solved
Thanks again, must be a problem my end, because now it is just showing the link to everyone.
[Image: mybbsig.php]


Forum Jump:


Users browsing this thread: 1 Guest(s)