Data Manager Example 
This is an example of an actual use of a data manager in vBulletin. It is a partial excerpt of the code used to register a new user.
// init user datamanager class
$userdata =& datamanager_init('User'$vbulletinERRTYPE_ARRAY);

// check for matching email addresses
if ($vbulletin->GPC['email'] != $vbulletin->GPC['emailconfirm'])
{
    
$userdata->error('emailmismatch');
}
// set email
$userdata->set('email'$vbulletin->GPC['email']);

$userdata->set('username'$vbulletin->GPC['username']);

// check referrer
if ($vbulletin->GPC['referrername'] AND !$vbulletin->userinfo['userid'])
{
    
$userdata->set('referrerid'$vbulletin->GPC['referrername']);
}

// Set specified options
if (!empty($vbulletin->GPC['options']))
{
    foreach (
$vbulletin->GPC['options'] AS $optionname => $onoff)
    {
        
$userdata->set_bitfield('options'$optionname$onoff);
    }
}

// ... additional data setting ...

$userdata->pre_save();

// check for errors
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

User Contributed Notes: Data Manager Example Add a Comment