When you updating any existing data using datamanager then you need to call
set_existing function first.
Try This Code: (Run this code after registration is complete)
PHP Code:
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($vbulletin->userinfo);
$userfields = array('field2' => $vbulletin->GPC['cfield_2'],
'field6' => $vbulletin->GPC['cfield_6'],
'field7' => $vbulletin->GPC['cfield_7']
);
// Saving Userfields Now
$userdata->set_userfields($userfields);
$newusergroupid = 9;
$userdata->set('usergroupid', $newusergroupid);
$userdata->pre_save();
if (!empty($userdata->errors))
{
$errorlist = '';
foreach ($userdata->errors AS $index => $error)
{
$errorlist .= "<li>$error</li>";
}
// ... additional code; $errorlist is outputted to the user
}
else
{
// save the data
$vbulletin->userinfo['userid'] = $userid = $userdata->save();
// ... additional processing code
}