MyBB Community Forums

Full Version: Merging two posts by the same user
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I hope I'm the 1st with this mod.

If somebody writes a new post in thread X, and he wrote the lastest post in this thread, it merges the new post with the previous one. It also prevents to add a post to post counter. But, however, it marks topic X as a topic with new posts (icon [Image: newfolder.gif]) and puts this topic into "Last post" column in the category list in main page.

Cool one, isn't it? ;P

To add it, you'll need to copy attached file to main directory of your forum or edit manually:

In file newreply.php

Line 482. in orginal is
 
$db->query("INSERT INTO ".TABLE_PREFIX."posts
(pid,tid,replyto,fid,subject,icon,uid,username,dateline,message,ipaddress,includesig,smilieoff,visible)
VALUES 
(NULL,'$tid','$replyto','$fid','$subject','$icon','$author','$username','$now','$message','$ipaddress','$postoptions[signature]','$postoptions[disablesmilies]','$visible')");
 
$pid = $db->insert_id();
And you need to change it to
$query = $db->query("SELECT uid,pid,message FROM
".TABLE_PREFIX."posts WHERE tid='$tid' ORDER BY dateline DESC LIMIT
1");
$lastpost = $db->fetch_array($query);
if ($lastpost['uid']!=$author) {
$db->query("INSERT INTO ".TABLE_PREFIX."posts
(pid,tid,replyto,fid,subject,icon,uid,username,dateline,message,ipaddress,includesig,smilieoff,visible)
VALUES 
(NULL,'$tid','$replyto','$fid','$subject','$icon','$author','$username','$now','$message','$ipaddress','$postoptions[signature]','$postoptions[disablesmilies]','$visible')");
$pid = $db->insert_id();
$post_just_edited="no";
} else {
$postid = $lastpost['pid'];
$old_message = $lastpost['message'];
$db->query("UPDATE ".TABLE_PREFIX."posts SET
message='".$old_message."\n * posts merged * \n".$message."', dateline='$now' WHERE pid='$postid'");
$pid = $db->insert_id();
$post_just_edited="yes";
}
and line 500. in orginal is
if($forum['usepostcounts'] != "no")
you need to change it to:
if(($forum['usepostcounts'] != "no")&&($post_just_edited!="yes"))

I hope you understood my bad english and it works. And sorry for destroying the layout Confused
Very very nice Smile, I love it. U should publish it one of the mod sites.