Commit 191661df authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Forum: group together consecutive deleted posts by the same user"

parents bfd393d5 c480904e
......@@ -118,6 +118,7 @@ $string['orderdescription'] = 'Choose where you want the forum to be ordered com
$string['Post'] = 'Post';
$string['postaftertimeout'] = 'You have submitted your change after timeout of %s minutes. Your change has not been applied.';
$string['postbyuserwasdeleted'] = 'A post by %s was deleted';
$string['postsbyuserweredeleted'] = '%s posts by %s were deleted';
$string['postdelay'] = 'Post delay';
$string['postdelaydescription'] = 'The minimum time (in minutes) that must pass before a new post can be mailed out to forum subscribers. The author of a post may make edits during this time.';
$string['postedin'] = '%s posted in %s';
{if $post->deleted}
<h5 class="deletedpost">{str tag="postbyuserwasdeleted" section="" args=display_name($post->poster)}</h5>
<h5 class="deletedpost">
{if $post->deletedcount > 1}
{str tag="postsbyuserweredeleted" section="" args=array($post->deletedcount,display_name($post->poster))}
{str tag="postbyuserwasdeleted" section="" args=display_name($post->poster)}
<div style="margin-left:auto; margin-right:0px; width:{$width}%">
{if $post->parent}
......@@ -131,8 +131,10 @@ $posts = get_records_sql_array(
// Get extra info of posts
foreach ($posts as $post) {
$prevdeletedid = false;
foreach ($posts as $postid => $post) {
// Get the number of posts
$post->postcount = get_postcount($post->poster);
......@@ -144,7 +146,23 @@ foreach ($posts as $post) {
$post->moderator = is_moderator($post->poster)? $post->poster : null;
// Update the subject of posts
$post->subject = !empty($post->subject) ? $post->subject : get_string('re', '', get_ancestorpostsubject($post->id));
// Consolidate deleted message posts by the same author into one "X posts by Spammer Joe were deleted"
if ($post->deleted) {
if ($prevdeletedid && $posts[$prevdeletedid]->poster == $post->poster) {
else {
$prevdeletedid = $postid;
$post->deletedcount = 1;
else {
$prevdeletedid = false;
// If the user has internal notifications for this topic, mark them
// all as read. Obviously there's no guarantee the user will actually
// read all the posts on this page, but better than letting the unread
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment