I didn't know you were using it in php. I thought it was a template. It should be like this then:
Code:
// Get the value for field 9
$user = $db->query_first("
SELECT field9
FROM " . TABLE_PREFIX . "userfield
WHERE userid = " . $vbulletin->userinfo['userid'] . "
");
// YES ANWSERS
if (is_member_of($vbulletin->userinfo, 23,33,43))
{
if ($user['field9'] == 'yes')
{
$membergroupids = $userdata->fetch_field('membergroupids');
if ($membergroupids)
{
$membergroupids = $membergroupids . ", 41";
}
else
{
$membergroupids = 41;
}
$userdata->set('membergroupids', $membergroupids);
}
}
if (is_member_of($vbulletin->userinfo, 2,24))
{
if ($user['field9'] == 'yes')
{
$userdata->set('usergroupid', 41);
}
// NO ANWSERS
if ($user['field9'] == 'no')
{
$userdata->set('usergroupid', 24);
}
}