Ok Im officially stumped on this one. The below code does not work and doesnt send the PM in one of the plugins I wrote.
HOWEVER, if I replace
$pmbody with something like 'hello test' (a string basically) then PM sends fine. It has something to do with the construct_phrase Im guessing here, but not sure what at this point
PHP Code:
global $vbulletin, $vbphrase;
$pmbody = construct_phrase($vbphrase['sendpm_on_palertpm'], $user['username'], $subscription['title']);
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->set('fromuserid', $vbulletin->options['sendpm_on_fromuserid']);
$pmdm->set('fromusername', $vbulletin->options['sendpm_on_fromusername']);
$pmdm->set('title', $vbulletin->options['sendpm_on_subject']);
$pmdm->set('message', $pmbody);
$pmdm->set_recipients($user['username'], $botpermissions);
$pmdm->set('dateline', TIMENOW);
$pmdm->save();