View Full Version : What is the easiest way to restrict content to a certain group?
kobescoresagain
04-03-2006, 01:50 AM
I have content that I am intergrating into a couple pages right now, everything seems to be working right, but I want to know how I can keep certain people from seeing it. I want to know basically something like and if statement that would do something liek this
if (usergroup == admin)
{
Show
}
else
{
Show something else
}
Deaths
04-03-2006, 03:50 PM
You can use this conditional in PHP:
if ($vbulletin->userinfo['usergroup'] == X)
{
// Your code here
} else {
//something else here
}
and change X to your admin usergroup.
kobescoresagain
04-04-2006, 02:25 PM
Deaths, I tried matching that to 6 because that is the usergroup for admin. It doesn't seem to work. It always outputs for not an admin, I changed the group and it does the same thing. I am coding for a vbadvanced page where I want the admin to be able to see a couple of extra things. I don't think I have access to the $vbulletin->userinfo['usergroup'] on that page, how can i get access to that?
Thanks
crashtd
04-16-2006, 06:04 PM
i'm trying to do the samething but for multiple usergroups...any progess?
Adrian Schneider
04-17-2006, 12:21 AM
// Note the ID at the end
if ($vbulletin->userinfo['usergroupid'] == 6)
{
echo "You're an administrator, eh!";
}
else
{
echo "Be gone, low level scum.";
}If you want to check secondary groups (or multiple, with ease):if (is_member_of($vbulletin->userinfo, 6, 7, 8))
{
echo "You're either a secondary or primary member of the groups 6 7 or 8.";
}
Using is_member_of allows to add as many groups as you'd like (somewhat new functionality)...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.