PDA

View Full Version : dealing with 2ndary usergroup


Keyser S?ze
11-26-2008, 04:23 AM
when dealing with them, do their set UG num change? cuzz my site is run off of vb and we use usergroups to allow or disallow ppl to do certain things

works great when dealing with primary usergroups, but secondary just does want to work, is there a reason?

if ($usergroup == $premid || $usergroup == $premidall){$bandlimit = $premlimit; $donateaccess = 1;}

elseif ($usergroup == $silvid || $usergroup == $silvidall){$bandlimit = $silvlimit; $donateaccess = 1;}

elseif ($usergroup == $platid || $usergroup == $platidall
|| $usergroup == 5 || $usergroup == 6 || $usergroup == 7 || $usergroup == 18 || $usergroup == 27 )
{$bandunlimited = 1; $donateaccess = 1; $platinumaccess=1; }


if ($usergroup == 5 || $usergroup == 6 || $usergroup == 7 || $usergroup == 18 || $usergroup == 27)
{$superuser=1;}

if ($usergroup == 6 || $usergroup == 18)
{$adminuser=1;}

// Uncomment to give everyone iso access
//$donateaccess = 1;


?>

Antivirus
11-26-2008, 02:39 PM
primary usergroup does not change. Best way to identify if a user belongs to a specific usergroup is to use the is_member_of() function which works for both primary as well as secondary usergroups. Typically, you would use it like this:

if (is_member_of($vbulletin->userinfo, 5,6,7,18,27))
{
echo 'I am in 1 or more primary or secondary usergroups: 5,6,7,18,27';
}




you can read full documentation onthe function in the vbulletin API (http://members.vbulletin.com/api/vBulletin/_includes---functions.php.html#functionis_member_of) located within the members section.