2013-06-15, 05:11 PM
I'm trying to send a PM to users that won a raffle using PHP.
The only problem I am having here is that using HTML in these PMs doesn't work.
I'm using the following function:
The only problem I am having here is that using HTML in these PMs doesn't work.
I'm using the following function:
function send_pm($pm){
global $lang, $mybb, $db;
if($mybb->settings['enablepms'] == 0)
return false;
if (!is_array($pm))
return false;
if (!$pm['subject'] ||!$pm['message'] || !$pm['touid'] || !$pm['receivepms'])
return false;
require_once MYBB_ROOT."inc/datahandlers/pm.php";
$pmhandler = new PMDataHandler();
$subject = $pm['subject'];
$message = $pm['message'];
$toid = $pm['touid'];
if (is_array($toid))
$recipients_to = $toid;
else
$recipients_to = array($toid);
$recipients_bcc = array();
$fromid = 0;
$pm = array(
"subject" => $subject,
"message" => $message,
"icon" => -1,
"fromid" => $fromid,
"toid" => $recipients_to,
"bccid" => $recipients_bcc,
"do" => '',
"pmid" => ''
);
$pm['options'] = array(
"signature" => 0,
"disablesmilies" => 0,
"savecopy" => 0,
"readreceipt" => 0
);
$pm['saveasdraft'] = 0;
$pmhandler->admin_override = 1;
$pmhandler->set_data($pm);
if($pmhandler->validate_pm())
{
$pmhandler->insert_pm();
}
else
{
return false;
}
return true;
}
and I call it using this:send_pm(array(
'subject' => "Test",
'message' => "Testing this shit?\nMy name is ".format_name("Ruben", 4).", thanks you.",
'receivepms' => 1,
'touid' => 1
), 0);
The output looks like this:Testing this shit?
My name is <span style="color: #FF0000;"><b>Ruben</b></span>, thanks you.
Anyone who can help me on allowing this?