public function reportContent($contentType, array $content, $message, array $viewingUser = null)
{
$reportId = parent::reportContent($contentType, $content, $message, $viewingUser);
if ($reportId == 0)
{
return false;
}
$users = $this->fetchAllKeyed('SELECT email, username, language_id FROM xf_user WHERE is_admin = 1 OR is_moderator = 1', 'user_id');
$report = $this->getReportById($reportId);
$userModel = $this->getModelFromCache('XenForo_Model_USer');
$reportedUser = $userModel->getUserById($report['content_user_id']);
$reportHandler = $this->getReportHandler($contentType);
list($contentId, $contentUserId, $contentInfo) = $reportHandler->getReportDetailsFromContent($content);
switch ($contentType)
{
case "post":
$mailTemplate = 'MODM_Phidippides_new_post_reported';
$params = array(
'user' => "",
'reportingUser' => $report['last_modified_username'],
'reportId' => $report['report_id'],
'reportMessage' => $message,
'reportedUser' => $contentInfo['username'],
'reportedThread' => $contentInfo['thread_title'],
'reportedNode' => $contentInfo['node_title'],
'reportedContent' => $contentInfo['message']);
break;
case "profile_post":
case "conversation_message":
default:
$mailTemplate = 'MODM_Phidippides_new_item_reported';
$params = array(
'user' => "",
'reportingUser' => $report['last_modified_username'],
'reportId' => $report['report_id'],
'reportMessage' => $message,
'reportedUser' => $reportedUser['username']);
}
foreach ($users as $user)
{
XenForo_Error::debug("Mail report sent to " . $user['email']);
$params['user'] = $user['username'];
$mail = new XenForo_Mail($mailTemplate, $params, $user['language_id']);
$mail->send($user['email'], $user['username']);
}
}