MyBB Hacks

Full Version: Nav. Links visible to members only
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello,

I am wondering how exactly I can add a link to the navigation (Header) template that only certain usergroups can see?

Lets say I want to add a link next to 'Search' called 'Staff Forums', How would I make it so only admins (GID 4) can see it?

Thanks.
Using template conditionals:

PHP Code:
<if $mybb->usergroup['gid'] == 4 then><a href="doom.php">Click here</a></if>

Perfect thanks mate. I knew I would need a way of getting PHP into templates but I guess common sense searching failed me :L.
(02-24-2011 09:28 AM)RateU Wrote: [ -> ]Template Conditional plugin link?
http://mybbhacks.zingaburga.com/showthread.php?tid=464

Thanks anyways I just meant I was to stupid to search :L

Question, if I wanted to make admins, mods and super mods to see that link it would be

PHP Code:
<if $mybb->usergroup['gid'] == 4 || $mybb->usergroup['gid'] == 6 || $mybb->usergroup['gid'] == 3 then><a href="doom.php">Click here</a></if>

Correct?

(02-24-2011 09:40 AM)ccalby Wrote: [ -> ]Thanks anyways I just meant I was to stupid to search :L
Sorry for misunderstood you Biggrin

(02-24-2011 09:40 AM)ccalby Wrote: [ -> ]Question, if I wanted to make admins, mods and super mods to see that link it would be

PHP Code:
<if $mybb->usergroup['gid'] == 4 || $mybb->usergroup['gid'] == 6 || $mybb->usergroup['gid'] == 3 then><a href="doom.php">Click here</a></if>

Correct?

You can use array in Template Conditional for simpler code.
What you mean? I have no clue here Tongue
Like this:

Code:
<if in_array($GLOBALS['mybb']->user['usergroup'], array(3,4,6)) then> 
bla bla bla
</if>

What I mean is, Template Conditional accept array in the <if...... then> function.
Great thanks for your help, heres some cookies Biggrin

[Image: Cookies2.jpg]
Pages: 1 2
Reference URL's