Hi!
I figured out how to modify the code. The code works fine when it is inserted after line 1507. This is just behind the hook "($hook = vBulletinHook::fetch_hook('register_activate_proce ss')) ? eval($hook) : false;"
The code is:
// Get the value for field 5
$user = $db->query_first("SELECT field5 FROM " . TABLE_PREFIX . "userfield WHERE userid = $userinfo[userid]");
if ($user['field5'] == 'Test')
{
$membergroupids = $userdata->fetch_field('membergroupids');
if ($membergroupids)
{
$membergroupids = 9;
}
else
{
$membergroupids = 9;
}
$userdata->set('membergroupids', $membergroupids);
}
My prob is, that it does not work when I use it as a plugin. Could anybody help?
I guess .... but it did'nt work
<?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'] == 'Mathebuch')
{
$membergroupids = $userdata->fetch_field('membergroupids');
if ($membergroupids)
{
$membergroupids = 9;
}
else
{
$membergroupids = 9;
}
$userdata->set('membergroupids', $membergroupids);
$userdata->save();
}]]></phpcode>
</plugin>
</plugins>
|