The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

phpbb : Aggregate double posts

Go down

Tutorial phpbb : Aggregate double posts

Post by Ange Tuteur October 31st 2014, 7:50 pm

phpbb : Aggregate double posts

This tutorial will allow you to group the posts of members who post twice or more in a row, automatically. This is applicable to versions phpbb2 and phpbb3.

phpbb : Aggregate double posts Captu197


Installing JavaScript

Go to Administration Panel > Modules > JavaScript codes management and create a new script.

Title : Your choice
Placement : In the topics
Paste the script below that corresponds to your forum version :

phpbb2 :
Code:
$(function() {
  var c = "", a, d = 0, b = 0;
  $("tr.post").each(function() {
    var e = $("> td:first span.name", this).text();
    e != c ? (d++, b++, a = $(this), b % 2 != d % 2 && $("> td", a).add($("> td", a.next())).toggleClass("row1 row2"), c = e) : (b++, $(a).find("div.signature_div").remove(), $("> td:last", a).append($("> td:last > table ", this).addClass("doublepost").attr("id", $(this).attr("id").replace(/^p([0-9]+)$/, "$1"))), $(this).next().remove(), $(this).remove())
  });
  var f = location.hash;
  location.hash = "";
  location.hash = f
});

phpbb3 :
Code:
$(function() {
  var c = "", a, d = 0, b = 0;
  $("div.post").each(function() {
    var e = $(".postprofile dt", this).text();
    e != c ? (d++, b++, a = $(this), b % 2 != d % 2 && a.toggleClass("row1 row2"), c = e) : (b++, $(a).find("div.signature_div").remove(), $("div.postbody", a).append($("div.postbody", this).attr("class", "doublepost").attr("id", $(this).attr("id").replace(/^p([0-9]+)$/, "$1"))), $(this).remove())
  });
  var f = location.hash;
  location.hash = "";
  location.hash = f
});


Modifying the CSS

The double posts are applied with the classname doublepost.

For example, we can add a style ( Administration Panel > Display > Colors > CSS stylesheet ) like this :
Code:
.doublepost { border-top:1px solid #888 }
To put a gray( #888 ) border of 1 pixel above the double posts.






Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum