function test_do()
{
global $mybb,$db,$user_info;
require_once MYBB_ROOT."inc/datahandlers/pm.php";
$pmhandler = new PMDataHandler();
$subject = "test";
$message = "you have been done wooo hahaahahaah";
$pm = array(
"subject" => $subject,
"message" => $message,
"icon" => -1,
"toid" => 1,
"fromid" => $mybb->user['uid'],
"do" => '',
"pmid" => ''
);
$pm['options'] = array(
"signature" => "1",
"disablesmilies" => "0",
"savecopy" => "0",
"readreceipt" => "0"
);
$pmhandler->set_data($pm);
if(!$pmhandler->validate_pm())
{
$pm_errors = $pmhandler->get_friendly_errors();
$send_errors = inline_error($pm_errors);
echo $send_errors;
}
else
{
$pminfo = $pmhandler->insert_pm();
}
unset($pm);
unset($pmhandler);
}
The function/hook is working where it should because if i add echo "test"; to the end it is displaying on the page. Any idea why this doesn't send a PM, no error displayed either.