Not sure what i'm doing wrong, here is the code i'm using, it is field5 that i'm wanting, and 'Female' is what i'm looking for, to put into group 33, if they aren't Female, then group 2. What have i done wrong?
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<plugins>
<plugin active="1" product="vbulletin">
<title>Put User in Secondary Group Based on Custom Profile Field Value</title>
<hookname>register_activate_process</hookname>
<phpcode><![CDATA[// Get the value for field 5
$user = $db->query_first("
SELECT field5
FROM " . TABLE_PREFIX . "userfield
WHERE userid = " . $vbulletin->userinfo['userid'] . "
");
if ($user['field5'] == 'Female')
{
$membergroupids = $userdata->fetch_field('membergroupids');
if ($membergroupids)
{
$membergroupids = $membergroupids . ", 33";
}
else
{
$membergroupids = 2;
}
$userdata->set('membergroupids', $membergroupids); }]]></phpcode>
</plugin>
</plugins>