Hey there,
This is exactly what I want to do, but I'm having a little trouble with it. I'm checking the correct field for the correct value (field6 is populating properly & I'm checking for the right values). It's hooked at the right place, register_activate_process.
I am using vB 3.5.2 - is that the problem? If so, any thoughts on how to get this to work?
Here's the code I'm using:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<plugins>
<plugin active="1" product="vbulletin">
<title>Put User In User Group Based on Field Value</title>
<hookname>register_activate_process</hookname>
<phpcode>
<![CDATA[
// Get the value for field 6
$user = $db->query_first("
SELECT field6
FROM " . TABLE_PREFIX . "userfield
WHERE userid = " . $vbulletin->userinfo['userid'] . "
");
if ($user['field6'] == 'chicago')
{
$userdata->set('usergroupid', 11);
}
if ($user['field6'] == 'cincinnati')
{
$userdata->set('usergroupid', 10);
}
if ($user['field6'] == 'indianapolis')
{
$userdata->set('usergroupid', 9);
}
]]>
</phpcode>
</plugin>
</plugins>
The values for field6 are set up to be all lowercase.
When I click the activation link in the email, a blank window pops up with this address...
http://www.mydomain.com/forums/regis...=15&i=80639843
...but it freezes there. The user gets activated, but is not assigned to the desired usergroup.
Thanks a bunch for any help.