<?phpforeach (explode(',',$userdata->fetch_field('membergroupids')) as $pg_group){ $pg_groupids[$pg_group] = $pg_group;}foreach (explode("\n",$vbulletin->options['profile_groups']) as $pg_triple){ list($pg_field,$pg_groupid,$pg_yes) = split(';',trim($pg_triple)); if ($pg_field and $pg_groupid) { if (!$pg_yes) { $pg_yes = 'Yes'; } if ($userdata->userfield[$pg_field] == $pg_yes) { if (!($pg_groupids[$pg_groupid])) { $pg_groupids[$pg_groupid] = $pg_groupid; } } else { if ($pg_groupids[$pg_groupid]) { $pg_groupids[$pg_groupid] = 0; } } }}foreach ($pg_groupids as $pg_groupid => $pg_value){ if ($pg_value == 0) { continue; } if ($pg_membergroups) { $pg_membergroups .= ',' . $pg_value; } else { $pg_membergroups = $pg_value; }}$userdata->set('membergroupids', $pg_membergroups);?>