I add plugin on "reputation_add_complete"
now, the user is receive this PM,but narbar (pm Unread ,Total ) is not update.
please help.
the code is
PHP Code:
if ($score < 0)
{
// Construct the message subject
$subject = $vbphrase['q_pm_on_decrease_repution_message_subject'];
// Construct the message text
$message = construct_phrase(
$vbphrase['q_pm_on_decrease_repution_message_text'],
$userinfo['username'],
$postid,
$db->escape_string(fetch_censored_text($vbulletin->GPC['reason']))
);
// Init the PM datamanager
$pm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
// Fill in the blanks
$pm->set('fromuserid', 1);
$pm->set('fromusername', 'admin');
$pm->set('title', $subject);
$pm->set('message', $message);
$pm->set_recipients($userinfo['username'], $userinfo['permissions']);
$pm->set('dateline', TIMENOW );
// Send the PM
if (empty($pm->errors))
{
// There are no errors, so send the PM
$pm->save();
}
}