Firefly, that's good, but for performance you should really use a switch as this would prevent the test of an array, convert to an array and loop through array stuff that happens partly implicitly...
try something like...
PHP Code:
switch ($bbuserinfo['usergroupid']) {
case 5:
case 6:
case 7:
// Do stuff for usergroups 5 or 6 or 7
break;
case 2:
// Do stuff for usergroup 2
break;
default:
// Do stuff for everyone else
}
Just an improvement. Doesn't change functionality... but under strain this should shine.