function modnotice_send_pm() {
global $mybb, $db, $url, $lang;
if(isset($mybb->input['moderate']) && $mybb->input['moderate'] == 1) {
require_once MYBB_ROOT."inc/functions_user.php";
$query = $db->simple_select("posts", "uid, username", "pid='".intval($mybb->input['pid'])."'");
$user= $db->fetch_array($query);
$lang->load('modnotice');
if($mybb->settings['modnotice_pm'] == 1) {
$url = $mybb->settings['bburl'].'/'.$url;
$url = str_replace('&', '&', $url);
$privatemessage = array(
'fromid' => 0,
'toid' => $user['uid'],
'uid' => $user['uid'],
'folder' => 1,
'subject' => $db->escape_string($lang->modnotice_PM_subject),
'icon' => 0,
'message' => $db->escape_string($lang->sprintf($lang->modnotice_PM_message, $db->escape_string($user['username']), $db->escape_string($url) )),
'dateline' => TIME_NOW,
'status' => 0,
'includesig' => 0,
'smilieoff' => 0,
'receipt' => 0,
'readtime' => 0,
);
$db->insert_query("privatemessages", $privatemessage);
update_pm_count($user['uid'], 7);
}
}