The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

phpbb : Aggregate double posts

View previous topic View next topic Go down

phpbb : Aggregate double posts

Post by Ange Tuteur on 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.



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
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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