I've created a new table in the vB database and plan to store certain information for users in it.
Is it possible to use vB's datamanager to input data into it? i.e. similar to the code below - or do I need to use plain MySQL and php to enter it?
If anyone could point me in the right direction I'd be very grateful.
PHP Code:
$vbulletin->input->clean_array_gpc('p', array(
'cfield_2' => TYPE_NOHTML,
'cfield_6' => TYPE_NUM,
'cfield_7' => TYPE_NUM
));
$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);
$userdata->pre_save();
if (!empty($userdata->errors))
{
$_REQUEST['do'] == '2';
$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();
$_REQUEST['do'] == '3';
// ... additional processing code
}