Auto Merge Double Post

Started by M-DVD, December 03, 2008, 10:18:25 AM

Previous topic - Next topic

M-DVD

Quote from: LOVELORD on January 30, 2009, 11:28:05 AM
Try now.. It must work...

Thanks, now I upload your translations.

Quote from: LOVELORD on January 30, 2009, 11:28:05 AM
Try now.. It must work...

Quote from: svobodniy on January 31, 2009, 05:10:28 AM
Quote from: M-DVD on January 29, 2009, 07:35:13 PM
svobodniy wants, the time that happened since the merger. (ie, 5 minutes later)
Do you try to do it?

Yes  :)

Quote from: M-DVD on January 28, 2009, 07:58:07 PM
Quote from: svobodniy on January 28, 2009, 05:15:25 PM
Is it possible to write something like "added 5 minutes later"?

I can try add this variable :)

Beer

QuoteSMF 1.1.7 Install - OK!
Admin messages in forum - no problem. User if added message in your message date 25/01/2009 - problem: "You may not modify this post as the time limit for edits has passed."
My settings Double Post:
Try set: Maximun time after posting to allow edit in 0.
Redone that you did and tell me if the error showed.
If Maximun time after posting to allow  0 - new post addet - no problem, new message no merge...

This seems to happen with one user. Profile it as all.

ccraciun

#182
@Beer: That means it's working fine now?

Quote from: M-DVD on January 30, 2009, 10:29:59 AM
Quote from: Beer on January 30, 2009, 03:59:52 AM
QuoteSMF 1.1.7 Install - OK!
Admin messages in forum - no problem. User if added message in your message date 25/01/2009 - problem: "You may not modify this post as the time limit for edits has passed."
My settings Double Post:

Try set: Maximun time after posting to allow edit in 0.
Redone that you did and tell me if the error showed.
...
Indeed, i also noticed this issue:
- if "Maximum time after posting to allow edit" is "1 minute" i can still add posts (which are merged fine) for ~ more then 3 - 4 minutes since the first posted message; after 8 minutes or so, the "cannot modify post" appeared;

There is a way to solve this?
I intend to allow an edit time of 10 minutes, but to allow unlimited merged messages posted sooner than 1 day after the 1st post. By the way: 1 day (time for allow the double post...) means 24 hours from the 1st post, am i right?
I don't want to allow unlimited time for editing a message (value = "0"), because this way a user may delete anytime the content of his messages...

And one other thing: "Time for will allow the Doble Post and Bump the Topic:" sounds a little strange, at least for my english knowledge. :) Maybe would be better: "Time to allow the Double Post and Bump the Topic:"


M-DVD

#183
Quote from: ccraciun on February 02, 2009, 04:47:13 PM
Indeed, i also noticed this issue:
- if "Maximum time after posting to allow edit" is "1 minute" i can still add posts (which are merged fine) for ~ more then 3 - 4 minutes since the first posted message; after 8 minutes or so, the "cannot modify post" appeared;

There is a way to solve this?
I intend to allow an edit time of 10 minutes, but to allow unlimited merged messages posted sooner than 1 day after the 1st post. By the way: 1 day (time for allow the double post...) means 24 hours from the 1st post, am i right?
I don't want to allow unlimited time for editing a message (value = "0"), because this way a user may delete anytime the content of his messages...

Quote from: Beer on February 01, 2009, 10:30:00 AM
If Maximun time after posting to allow  0 - new post addet - no problem, new message no merge...

This seems to happen with one user. Profile it as all.

Ok, for the next version I will have this in mind.

Even I haven't studied this problem, but in the meantime, I think they can try this little hack.

Search in Sources/Subs-Post.php:
	
$_REQUEST['msg'] = $_GET['msg'] = $row['id_last_msg'];


Add before:
	
$modSettings['edit_disable_time'] = 0;



Quote from: ccraciun on February 02, 2009, 04:47:13 PM
And one other thing: "Time for will allow the Doble Post and Bump the Topic:" sounds a little strange, at least for my english knowledge. :) Maybe would be better: "Time to allow the Double Post and Bump the Topic:"

Thanks, also i will correct this.  :)

ccraciun

Quote from: M-DVD on February 03, 2009, 07:57:44 PM
Search in Sources/Subs-Post.php:
	
$_REQUEST['msg'] = $_GET['msg'] = $row['id_last_msg'];


Add before:
	
$modSettings['edit_disable_time'] = 0;

It works!
Thanks a lot!

mark7144

The correct english: "Time before a double post will bump the topic"

svobodniy

Quote from: M-DVD on January 31, 2009, 09:10:37 PM
Quote from: svobodniy on January 31, 2009, 05:10:28 AM
Quote from: M-DVD on January 29, 2009, 07:35:13 PM
svobodniy wants, the time that happened since the merger. (ie, 5 minutes later)
Do you try to do it?
Yes  :)
I done it myself.

In ManagePosts.php search for:
array('int', 'AutoMergePost_time', 'postinput' => $txt['days_word'], 'subtext' => $txt['AutoMergePost_time_sub']),
replace:
array('int', 'AutoMergePost_time', 'postinput' => $txt['AutoMergePost_min'], 'subtext' => $txt['AutoMergePost_time_sub']),

In Subs-Post.php search for:
function doublePostCheck()
{
global $smcFunc, $user_info, $topic, $modSettings;

replace:
function doublePostCheck()
{
global $smcFunc, $user_info, $topic, $modSettings, $txt;

search for:
// Allow Bump?
if (time() >= ($modSettings['AutoMergePost_time'] * 86400 + $row['poster_time']))
return;

// Now Modify >:D
$_REQUEST['msg'] = $_GET['msg'] = $row['id_last_msg'];
$_REQUEST['subject'] = $_POST['subject'] = addslashes(un_htmlspecialchars($row['subject']));
$_REQUEST['message'] = $_POST['message'] = un_htmlspecialchars(un_preparsecode($row['body'])) . "\n" . str_replace('$date', '[time]'.time().'[/time]', $modSettings['AutoMergePost_div']) . "\n" . $_POST['message'];

replace:
// Allow Bump?
if (time() >= ($modSettings['AutoMergePost_time'] * 60 + $row['poster_time']))
return;

// Now Modify >:D
$_AMDP_min = floor((time()-$row['poster_time'])/60);
$_AMDP_sec = ((time()-$row['poster_time'])%60);
if ($_AMDP_min < 1)
$_AMDP_time = "$_AMDP_sec " . $txt['AutoMergePost_sec'];
else
$_AMDP_time = "$_AMDP_min " . $txt['AutoMergePost_min'] . " $_AMDP_sec " . $txt['AutoMergePost_sec'];
$_REQUEST['msg'] = $_GET['msg'] = $row['id_last_msg'];
$_REQUEST['subject'] = $_POST['subject'] = addslashes(un_htmlspecialchars($row['subject']));
$_REQUEST['message'] = $_POST['message'] = un_htmlspecialchars(un_preparsecode($row['body'])) . "\n" . str_replace('$time', $_AMDP_time, $modSettings['AutoMergePost_div']) . "\n" . $_POST['message'];


In Modifications.english.php add:
$txt['AutoMergePost_min'] = 'min.';
$txt['AutoMergePost_sec'] = 'sec.';


For russian, in Modifications.russian-utf8.php add:
$txt['AutoMergePost_min'] = 'мин.';
$txt['AutoMergePost_sec'] = 'сек.';


Results:
1)
Quotethe time that happened since the merger. (ie, 5 minutes later)
2) and I added one more "convenience": in the settings you don't write "days", you write "minutes" - i think it's more comfortable.

In the attachment this mod only for SMF 2+ and contains english and russian_utf8 langs.

M-DVD

Quote from: ccraciun on February 04, 2009, 01:58:07 AM
It works!
Thanks a lot!

Thanks, in the next version i will add this.

Quote from: mark7144 on February 04, 2009, 07:35:59 AM
The correct english: "Time before a double post will bump the topic"

Thanks, in the next version i will correct this and the ccraciun's and Nao's corrections.

Quote from: svobodniy on February 04, 2009, 08:23:18 PM
Quote from: M-DVD on January 31, 2009, 09:10:37 PM
Quote from: svobodniy on January 31, 2009, 05:10:28 AM
Quote from: M-DVD on January 29, 2009, 07:35:13 PM
svobodniy wants, the time that happened since the merger. (ie, 5 minutes later)
Do you try to do it?
Yes  :)
I done it myself.

Ok, perfect. I am glad you have resolved.

This gives me more time.  :P

--

The next version will not come soon, but after a few weeks or month. First I have to fix some MODs that are incompatible with the new profile of SMF RC1, check other things, and attend to other matters.

Thank you.

Kuzmitch

Hi M-DVD!

Thanks for the great mod, I use it on the forum with about 1.8M messages. It really saved my commerce boards from "bumping madness".

Unfortunately on my VPS sever I found a strange bug: this query sometimes execute infinitly and locks messages and threads tables:

$result = db_query("
SELECT
t.ID_LAST_MSG, m.subject, m.body, m.posterTime
FROM
{$db_prefix}topics AS t, {$db_prefix}messages AS m
WHERE
t.ID_LAST_MSG = m.ID_MSG
AND m.ID_TOPIC = $topic
AND m.ID_MEMBER = $ID_MEMBER
LIMIT 1"
,__FILE__,__LINE__
);


Do you have any ideas why does it happen? The performance of the whole forum is OK, mysql is tuned, I use eAccelerator, nginx to lower the server load. Forum has about 500 people online.

Thanks in advance.

autogespot.com

Is there a possibility to merge posts manually instead of automatically? Some double posts don't have to be merged.

CvH

hi,  have made an german and an german-utf8 translation :)

great mod  ;D

autogespot.com

I did a dutch one. Don't know how to do it in utf8

Kuzmitch

Quote from: Kuzmitch on February 11, 2009, 05:29:49 AM
Unfortunately on my VPS sever I found a strange bug: this query sometimes execute infinitly and locks messages and threads tables:

Forget about that - I've finally found the bug in MySQL misconfiguration. :)

M-DVD

Quote from: autogespot.com on February 12, 2009, 12:35:40 PM
I did a dutch one. Don't know how to do it in utf8

Quote from: CvH on February 12, 2009, 11:13:38 AM
hi,  have made an german and an german-utf8 translation :)

great mod  ;D

Thanks for your comments :D, soon (tomorrow), I will update the language pack.

Quote from: autogespot.com on February 11, 2009, 07:10:20 AM
Is there a possibility to merge posts manually instead of automatically? Some double posts don't have to be merged.

Yes, it is possible to do so in the future, medium or far.

Quote from: Kuzmitch on February 12, 2009, 03:41:03 PM
Quote from: Kuzmitch on February 11, 2009, 05:29:49 AM
Unfortunately on my VPS sever I found a strange bug: this query sometimes execute infinitly and locks messages and threads tables:

Forget about that - I've finally found the bug in MySQL misconfiguration. :)

This query is very light, I saw no problem in it, but i preferred be sure before. And I'm glad you've solved the problem (and you've notified ;)).


Thanks.

--

Thanks, the language packs have been uploaded.  :)

Kuzmitch

Hi, it's me again :)

The problem is back and I finally found the solution. I'm not sure that it is the global problem which will exist on every MySQL server, but it helps me to avoid table-locking problem on every post.

I've made a small modification in the same query: in WHERE block I changed "m.ID_TOPIC = $topic" to "t.ID_TOPIC = $topic" and now everythink works fine.

It seems like on the large smf_messages table (mine is about 800 Mb) we have problems with indexes selection and it's good idea to use smf_topics table where it's possible.

Thanx!

M-DVD

Oh,  :o  ok, i didn't know that this could create problem with big DB.

Thank you very much for notify and the Fix. :P

If you want, you can do this test, it may be better.

SELECT
t.ID_LAST_MSG, m.subject, m.body, m.posterTime
FROM
{$db_prefix}topics AS t
INNER JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_LAST_MSG)
WHERE m.ID_TOPIC = {$topic}
AND m.ID_MEMBER = {$ID_MEMBER}
LIMIT 1


If you do this test, tell me the result, to place the final change in the next version.

Kuzmitch

Hi,

Just tried that query. Unfortunately the problems are back. It's kind of mistery :) I'll better stay with my personal mod, It seems like it works only at my forum.

I'm not a MySQL guru, but I found one mention that the queries could freeze with "Sending data" if you have bad (or large) indexes on the table and if you do this selection on the indexed field. I've did the repairs for the all tables for the several times, but It doesn't help.

Let leave our post in this thread and probably in the future it will help someone with the similar problems.

Yours,
Michael

M-DVD

Ok, then I will make this change, to be included in next update.

Thanks :)

narcolog

This mod doesn't work correctly with "AJAX Instant Quick Reply". After poster sends double message, it shows 2 messages: first without merge and second with 2 merged messages. But after refresh everything shows OK.

LOVELORD

How to allow Allow auto merge in some forums, but in others to disable???  ::)

Advertisement: