Quote:
Originally Posted by kh99
You really should be doing the second part of that (checking errors before calling save()), because it's the call to save() that's triggering an exception and showing all that info.
|
Uh excuse my stupid question but would the code be like this?
function pm_api($pmfromuserid, $pmfromusername, $pmtitle, $pmmessage, $username)
{
global $vbulletin, $botpermissions;
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->set('fromuserid', $pmfromuserid);
$pmdm->set('fromusername', $pmfromusername);
$pmdm->set('title', $pmtitle);
$pmdm->set('message', $pmmessage);
$pmdm->set_recipients($username, $botpermissions);
$pmdm->set('dateline', TIMENOW);
if (!isset($pmdm->errors()))
{
$pmdm->save();
}
unset($pmdm);
return $pmdm;
}
Or simply replacing ->save() with errors() ?