Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Nav. Links visible to members only
English Muffin Offline
Junior Member
**
Posts: 15
Joined: Apr 2010
Post: #1
Nav. Links visible to members only
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.
02-24-2011 09:01 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Nav. Links visible to members only
Using template conditionals:

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


My Blog
02-24-2011 09:09 AM
Find all posts by this user Quote this message in a reply
English Muffin Offline
Junior Member
**
Posts: 15
Joined: Apr 2010
Post: #3
RE: Nav. Links visible to members only
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:19 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #4
RE: Nav. Links visible to members only
Template Conditional plugin link?
http://mybbhacks.zingaburga.com/showthread.php?tid=464

02-24-2011 09:28 AM
Find all posts by this user Quote this message in a reply
English Muffin Offline
Junior Member
**
Posts: 15
Joined: Apr 2010
Post: #5
RE: Nav. Links visible to members only
(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?

(This post was last modified: 02-24-2011 09:40 AM by English Muffin.)
02-24-2011 09:40 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #6
RE: Nav. Links visible to members only
(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.

02-24-2011 09:47 AM
Find all posts by this user Quote this message in a reply
English Muffin Offline
Junior Member
**
Posts: 15
Joined: Apr 2010
Post: #7
RE: Nav. Links visible to members only
What you mean? I have no clue here Tongue
02-24-2011 09:49 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #8
RE: Nav. Links visible to members only
Like this:

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



[Image: leelink.gif]
MYBB1.6 & XThreads
02-24-2011 09:56 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #9
RE: Nav. Links visible to members only
What I mean is, Template Conditional accept array in the <if...... then> function.

02-24-2011 09:56 AM
Find all posts by this user Quote this message in a reply
English Muffin Offline
Junior Member
**
Posts: 15
Joined: Apr 2010
Post: #10
RE: Nav. Links visible to members only
Great thanks for your help, heres some cookies Biggrin

[Image: Cookies2.jpg]
02-24-2011 09:58 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: