Automerge Double Posts

Go down

Automerge Double Posts Empty Automerge Double Posts

Post by Wecoc June 11th 2020, 3:02 pm

This is a feature I've been using in my forum: When a user makes multiple posts in a row they are displayed as part of the same post, with a thin line that seperates their content. The merge is applied on the post box, and the profile and signature are displayed only once, but the quote/edit/etc buttons, the post title and date, the reputation/like system and the edit text are still displayed in each one separately, for obvious reasons.

Example:
Automerge Double Posts Multipost-test

It's not just double posts, if there are 15 posts in a row it will be applied on all them in the same manner (and you should probably ban that user, lol).

I've tested it only on phpBB3 but it's pretty basic and should work in others as well, maybe with a few edits... I'll appreciate feedback on that Smile

1. Javascript


Add this on the Javascript list, with position option "In topics".

Code:
/*
* -- Automerge Double Posts --
* Version: 1.0 EN (2020-06-11) [phpBB3]
* Author: Wecoc
* Description: When a user makes multiple posts in a row, they are displayed as part of the same post,
* with a thin line that seperates their content.
*/

$(function() {
  var posts = $(".post");
  if (posts.length < 2) return;
  for(var i=0; i<posts.length; i++ ) {
    var post = posts[i], author = post.querySelector(".author a");
    if (author == null) break;
    author = author.innerText;
    if (i > 0) {
      var prev_post = posts[i-1], prev_author = prev_post.querySelector(".author a");
      if (prev_author == null) break;
      prev_author = prev_author.innerText;
      if (author == prev_author) {
        $(post).addClass("has_prev");
      }
    }
    if (i < (posts.length - 1)) {
      var next_post = posts[i+1], next_author = next_post.querySelector(".author a");
      if (next_author == null) break;
      next_author = next_author.innerText;
      if (author == next_author) {
        $(post).addClass("has_next");
        post.appendChild(next_post);
      }
    }
  }
});

2. CSS


Code:
/* Hide the signature on multiposts */
.post.has_next > .inner > .postbody > .signature_div { display: none; }

/* Hide the profile on multiposts */
.post.has_next .post .postprofile { display: none; }

/* Hide the scroll buttons on multiposts */
.post.has_next > .inner > div.clear, .post.has_next > .inner > p.right { display: none; }

/* Change the basic format of the multiposts and add a border line to separate them */
.post.has_next .post {
  border: none;
  box-shadow: none;
  float: left;
  margin-top: 10px;
  padding-top: 10px;
  width: 100%;
  border-top: 2px solid #313131 !important;
  border-radius: 0 !important;
}
Wecoc
Wecoc
Forumember

Male Posts : 143
Reputation : 107
Language : Catalan, Spanish, English

View user profile

skouliki, SarkZKalie, TonnyKamper and Occultist like this post

Back to top Go down

Automerge Double Posts Empty Re: Automerge Double Posts

Post by Neptune- June 11th 2020, 3:52 pm

Hello,


We have a similar tutorial on French Support Forum.

If it can help, works for phpBB2 too

Translated in Automerge Double Posts Flag-es -> phpbb: Agregada doble publicación

And in Automerge Double Posts Flag-gb -> phpbb: Aggregate double post
Neptune-
Neptune-
Forumember

Male Posts : 430
Reputation : 97
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : France

View user profile https://www.galaxie-series.net/

Back to top Go down

Automerge Double Posts Empty Re: Automerge Double Posts

Post by YoshiGM June 11th 2020, 5:56 pm

Neptune is right.. We already have a tutorial created by Ea/Etana written some years ago Wink
But, thanks for the tip cheers
YoshiGM
YoshiGM
Active Poster

Male Posts : 1076
Reputation : 131
Language : Spanish & English
Location : Mexico

View user profile http://asistencia.foroactivo.com/u21373

Back to top Go down

Automerge Double Posts Empty Re: Automerge Double Posts

Post by jucarese October 2nd 2020, 8:34 pm

Hi @Wecoc can you prepare for the other new platforms ???? ModernBB and AwesomeBB
thanks
jucarese
jucarese
Active Poster

Male Posts : 1828
Reputation : 72
Language : spanish
Location : SSF Admin

View user profile http://asistencia.foroactivo.com/u23082

TonnyKamper likes this post

Back to top Go down

Automerge Double Posts Empty Re: Automerge Double Posts

Post by Simone Boi February 23rd 2021, 7:47 am

Doesn't work for me with ModernBB, any tips?
avatar
Simone Boi
Forumember

Posts : 65
Reputation : 1
Language : Italian

View user profile https://gamespledge.forumattivo.com/

Back to top Go down

Automerge Double Posts Empty Re: Automerge Double Posts

Post by YoshiGM February 23rd 2021, 3:48 pm

@Simone Boi wrote:Doesn't work for me with ModernBB, any tips?

You need to wait a new update of the code.
They need to change some parts to work in the other versions Confused
YoshiGM
YoshiGM
Active Poster

Male Posts : 1076
Reputation : 131
Language : Spanish & English
Location : Mexico

View user profile http://asistencia.foroactivo.com/u21373

Simone Boi likes this post

Back to top Go down

Automerge Double Posts Empty Re: Automerge Double Posts

Post by Bipo March 21st 2021, 2:22 pm

Hello everyone,

The trick proposed by Ea, on the French support, no longer works. She was removed from the list in early March 2021.

For the ModernBB version:

Administration Panel  Display  Pictures and Colors  ColorsCSS stylesheet

Code:
/* Hide the signature on multiposts */
.post.has_prev > .postbody > .signature_div { display: none; }
 
/* Hide the profile on multiposts */
.post.has_next .post .postprofile { display: none; }
 
/* Change the basic format of the multiposts and add a border line to separate them */
.post.has_next .post {
  border: none;
  box-shadow: none;
  float: left;
  margin-top: 10px;
  padding-top: 10px;
  width: 100%;
  border-top: 3px solid #3793ff !important;
  border-radius: 0 !important;
}

Administration Panel  Modules  JavaScript codes management

Code:
/*
* -- Automerge Double Posts --
* Version: 1.0 EN (2021-03-21) [ModernBB]
* Author: Wecoc & Bipo
* Description: When a user makes multiple posts in a row, they are displayed as part of the same post,
* with a thin line that seperates their content.
*/
 
$(function() {
  var posts = $(".post");
  if (posts.length < 2) return;
  for(var i=0; i<posts.length; i++ ) {
    var post = posts[i], author = post.querySelector(".postprofile-name a");
    if (author == null) break;
    author = author.innerText;
    if (i > 0) {
      var prev_post = posts[i-1], prev_author = prev_post.querySelector(".postprofile-name a");
      if (prev_author == null) break;
      prev_author = prev_author.innerText;
      if (author == prev_author) {
        $(post).addClass("has_prev");
      }
    }
    if (i < (posts.length - 1)) {
      var next_post = posts[i+1], next_author = next_post.querySelector(".postprofile-name a");
      if (next_author == null) break;
      next_author = next_author.innerText;
      if (author == next_author) {
        $(post).addClass("has_next");
        post.appendChild(next_post);
      }
    }
  }
});

You can view the result here: https://betatestmodernbb.forumactif.com/t13-merge-test-foumotion-trick




For the AwesomeBB version:

Administration Panel  Display  Pictures and Colors  ColorsCSS stylesheet

Code:
/* Hide the signature on multiposts */
.post-wrap.has_prev > .post-body > .post > .post-content > .post-signature { display: none; }
 
/* Hide the profile on multiposts */
.post-wrap.has_prev .post-body .post-aside { display: none;}

/* Hide the space post on multiposts */
.post-wrap.has_prev .post { margin: 0px 3px 0;}

Administration Panel  Modules  JavaScript codes management

Code:
/*
* -- Automerge Double Posts --
* Version: 1.0 EN (2021-03-21) [AwesomeBB]
* Author: Wecoc & Bipo
* Description: When a user makes multiple posts in a row, they are displayed as part of the same post,
* with a thin line that seperates their content.
*/
 
$(function() {
  var posts = $(".post-wrap");
  if (posts.length < 2) return;
  for(var i=0; i<posts.length; i++ ) {
    var post = posts[i], author = post.querySelector(".post-author a");
    if (author == null) break;
    author = author.innerText;
    if (i > 0) {
      var prev_post = posts[i-1], prev_author = prev_post.querySelector(".post-author a");
      if (prev_author == null) break;
      prev_author = prev_author.innerText;
      if (author == prev_author) {
        $(post).addClass("has_prev");
      }
    }
    if (i < (posts.length - 1)) {
      var next_post = posts[i+1], next_author = next_post.querySelector(".post-author a");
      if (next_author == null) break;
      next_author = next_author.innerText;
      if (author == next_author) {
        $(post).addClass("has_next");
        post.appendChild(next_post);
      }
    }
  }
});


Best regards.
Bipo.
Bipo
Bipo
New Member

Posts : 2
Reputation : 1
Language : French only.

View user profile

Ape, SarkZKalie, TonnyKamper and Wecoc like this post

Back to top Go down

Automerge Double Posts Empty Re: Automerge Double Posts

Post by ktsky1 March 24th 2021, 7:14 am

It looks cool
ktsky1
ktsky1
New Member

Posts : 1
Reputation : 1
Language : CN

View user profile

Back to top Go down

Automerge Double Posts Empty Re: Automerge Double Posts

Post by SLGray March 24th 2021, 8:26 pm

Please do not post links to things that guests can not see.  We as guests can not see the page you linked.


Automerge Double Posts Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 48972
Reputation : 3415
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top


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