PDA

View Full Version : Check if userid is member of usergroup


James Birkett
03-17-2010, 04:43 PM
How do I check if a userid is in a specific usergroup?

E.g: I want to check if userid 1 is an Administrator (usergroupid 6), how would I do that.

I would like a method that'd work for multiple userids.

I'm writing a quick plugin that allows me to apply certain functions to a person's username, based on their user ID.

I have a box to input userids (separated by commas) and a box to input usergroup exceptions (e.g. stop this effect being placed on an administrator).

The code I have:


if(($vbulletin->options['username_manipulation_shuffle_enable']) && ($vbulletin->options['username_manipulation_userid'])){
$array = explode(',', $vbulletin->options['username_manipulation_userid']);
$exceptions = $vbulletin->options['username_manipulation_shuffle_exceptions'];
foreach($array as $usid){
if(($user['userid'] == $usid) && (!is_member_of($bbuserinfo, $exceptions))){
//code
}
}
}



I want this to apply all over the forum, as well as the shoutbox.