Browse Source

Deleting a moderator comment

Signed-off-by: Suki <[email protected]>
Suki 11 years ago
parent
commit
426eefd4e2

+ 11 - 0
Sources/ReportedPosts.php

@@ -289,6 +289,17 @@ function HandleComment()
 		saveModComment($report_id, array($report_id, $newComment, time()));
 	}
 
+	// Deleting a comment?
+	if (!empty($REQUEST['delete']))
+	{
+		$comment_id = (int) $_REQUEST['mid'];
+
+		if (empty($comment_id))
+			fatal_lang_error('mc_reportedp_comment_none_found');
+
+		deleteModComment($comment_id);
+	}
+
 	//Redirect to prevent double submission.
 	redirectexit($scripturl . '?action=moderate;area=reports;sa=details;report=' . $report_id);
 }

+ 9 - 0
Sources/Subs-ReportedPosts.php

@@ -392,4 +392,13 @@ function saveModComment($report_id, $data)
 			array('id_task')
 		);
 }
+
+function deleteModComment($comment_id)
+{
+	global $smcFunc;
+
+	$smcFunc['db_query']('', '
+		DELETE FROM {db_prefix}log_comments
+		WHERE id_comment = {int:id}', array('id' => $comment_id, ));
+}
 ?>

+ 1 - 0
Themes/default/languages/ModerationCenter.english.php

@@ -37,6 +37,7 @@ $txt['mc_reportedp_by'] = 'by';
 $txt['mc_reportedp_reported_by'] = 'Reported By';
 $txt['mc_reportedp_last_reported'] = 'Last Reported';
 $txt['mc_reportedp_none_found'] = 'No Reports Found';
+$txt['mc_reportedp_comment_none_found'] = 'No Moderator Comment Found';
 $txt['mc_reportedp_comment_edit'] = 'Edit';
 $txt['mc_reportedp_comment_delete'] = 'Delete';
 $txt['mc_reportedp_details'] = 'Details';