PDA

View Full Version : Navbar Links based on usergroups


Trek
02-09-2009, 07:33 PM
I'd like to be able to only display a particular navbar item based on a set of usergroups I define. I wouldn't think this would be too hard to do, but I'm not sure where to start.

Has anyone done this, can offer pointers, etc?

Thanks!

UKBusinessLive
02-09-2009, 08:10 PM
I made a set of Dropdown Menus (https://vborg.vbsupport.ru/showthread.php?t=203521 ) which some admin wanted to add a serperate tab which only he and his mods could view.

Using conditionals to wrap an entire tab block like the example below


<if condition="is_member_of($vbulletin->userinfo, X, X, X)">

<li><a class="qmparent" href="javascript:void(0)">ADMIN & MODS ONLY</a>

<ul>
<li><a href="http://www.ukbusinesslive.co.uk/forum/profile.php?do=editavatar" title="Edit Avatar">Edit Avatar</a></li>
<li><a href="http://www.ukbusinesslive.co.uk/forum/profile.php?do=editsignature" title="Edit Signature">Edit Signature</a></li>
<li><a href="http://www.ukbusinesslive.co.uk/forum/profile.php?do=editoptions" title="Edit Options">Edit Options</a></li>
<li><span class="qmdivider qmdividerx" ></span></li>
<li><a href="http://www.ukbusinesslive.co.uk/forum/subscription.php?do=viewsubscription" title="List Subscriptions">List Subscriptions</a></li>
</ul></li>
</if>

<li><span class="qmdivider qmdividery" ></span></li>
<li><a class="qmparent" href="javascript:void(0)">PRIVATE MESSAGES</a>

<ul>
<li><a href="http://www.ukbusinesslive.co.uk/forum/private.php" title="List Messages">List Messages</a></li>
<li><a href="http://www.ukbusinesslive.co.uk/forum/private.php?do=newpm" title="Send New Message">Send New Message</a></li>
<li><a href="http://www.ukbusinesslive.co.uk/forum/private.php?s=&pp=&folderid=-1" title="Sent Messages">Sent Messages</a></li>
<li><a href="http://www.ukbusinesslive.co.uk/forum/private.php?do=trackpm" title="Track Messages">Track Messages</a></li>
<li><a href="http://www.ukbusinesslive.co.uk/forum/private.php?do=editfolders" title="Edit Folders">Edit Folders</a></li>
</ul></li>




You can see from the top block, that the condition surrounds its and is viewable by usergroup X, X, X which is defined by whatever usergroup number you want to add.

The bottom block is viewable by everyone :)

Hope that helps :up:

The

Trek
02-09-2009, 08:55 PM
It looks like that condition is exactly what I needed, thank you very much!

--------------- Added 1234220413 at 1234220413 ---------------

Added it to my template, works perfectly, thanks again for the tip on that function!

UKBusinessLive
02-09-2009, 09:01 PM
It looks like that condition is exactly what I needed, thank you very much!

--------------- Added 1234220413 at 1234220413 ---------------

Added it to my template, works perfectly, thanks again for the tip on that function!

Glad to help :D