Hi, I'm a novice at php and I'm having trouble with this script I'm trying to write.
It should check the usergroupid of the visitor, and then do either action1 or action2 depending which group they're in. I can get the usergroupid OK and I've checked it by echoing to screen.

This is my code so far
PHP Code:
$allowbbgroups "5,6";
 
$bbusergroupid code to get usergroupid of visitor
 
$bbgids 
explode(",",$allowbbgroups);
 
$i 0;
 
$a count($bbgids);
 if (
$a 1) {
  
$bbusergrps "$bbusergroupid=='$bbgids[0]'";
  ++
$i;
  while (
$i $a) {
  
$bbusergrps .= " OR $bbusergroupid=='$bbgids[$i]'";
  ++
$i;
  }
 } else {
  
$bbusergrps "$bbusergroupid==$bbgids[$i]";
 }
 
if (
$bbusergrps) {
  do 
action1
} else {
  do 
action2

Any ideas on how to explode the $allowbbgroups and use them in the action1 if statement?
The method above doesn't work, it does action1 regarless of the usergoupid.

Thanks.