PDA

View Full Version : hidden link


switch
10-06-2003, 07:11 AM
Just a quick question. I would like to have a few links in my nav, but I would like certain links to only be shown either to mods or admins. I would like the link to show based on there group. How would I do this.

Thanks in advance

Rein Masamuri
10-06-2003, 07:44 AM
Ok, I did a quick put together of code here and I havn't tested it so :S
First off goto your templates and goto the template named phpincludes

at the very bottom put:

//if admin
if ($bbuserinfo['userid'] == 6)
{
//show this button
$specialnav = '<a href="url"><img src="{imagesfolder}/adminimage.gif" alt="hover text" border="0"></a>';
}

//like above, the number is equal to the usergroup - this next one is if moderator
if ($bbuserinfo['userid'] == 7)
{
//then show this image
$specialnav = '<a href="url"><img src="{imagesfolder}/modimage.gif" alt="hover text" border="0"></a>';
}


Change the needed items to fit your need and put the $specialnav where you want the image
you can also change the == to < or > if you want a certain range of users to have a certain image.
good luck ^_^

KuraFire
10-06-2003, 08:47 AM
You can check which usergroupid's belong to which group in the Usergroup manager. Hover over the edit link and check your statusbar...

By default, vB2 creates:

admins = usergroupid 6
moderators = usergroupid 7
supermods = usergroupid 5
members = usergroupdi 2

oh, and the template is phpinclude, no s :)

switch
10-06-2003, 04:33 PM
Thanks for the quick replies. I guess I should have mentioned this part. I wanted to do it from a non-vb page. I wanted to do something like this:

<?php if ((isset($_SESSION['usergroupid'])) && ($_SESSION['usergroupid']==3)) { ?>

Bascially if the usergroupid matches the users group the link would show. What would be the best way to go about this.

Thanks again

Rein Masamuri
10-07-2003, 07:11 AM
Search for vbtemplates, it allows you to make vBulletin powered pages, and you can call variables with it.