stepan
Apr 9 2003, 07:02 AM
When a visitor submits a comment, sometimes it takes a while for the comment page to refresh to reflect that their comment was successfully added. During this time, the user may click the "Post" button again (and again...) which causes their comment to be submitted multiple times.
This hack modifies MovableType to simply ignore the same comment being entered multiple times for an entry.
http://www.nonplus.net/software/mt/Avoidin...ateComments.htm
mcroft
Apr 9 2003, 07:53 AM
that's pretty cool. I just left a comment on your blog, because I want to do/have the same thing for trackbacks. I get double-trackback all too frequently...
toesocks
Apr 9 2003, 08:17 AM
thanks! i just tried it and it works great.
stepan
Apr 9 2003, 08:30 AM
QUOTE
I want to do/have the same thing for trackbacks. I get double-trackback all too frequently...
Hmm, aren't sometimes multiple pings legit? For example, mt-plugins.org uses pings to be notified when a new version of a plugin is available.
When you receive a duplicate ping from the same URL, what should happen if the excerpt or title are different, or if "a lot of time" has experied since the previous ping?
Add the new ping? Replace the original one? Ignore it?
micahgoulart
Apr 9 2003, 09:12 AM
why not just disable the "POST" submit button when it's clicked using javascript?
this.disabled = true;
wouldnt that be enough to stop the button from being clicked twice?
kadyellebee
Apr 9 2003, 11:44 AM
Okay, I'm not good enough at reading the perl code yet, but this looks like a good one to integrate into my system... I have a question though... what is being compared between the comments to reject the multiples? If its the commenters name, I can think of times that I've forgotten something in a comment, and then commented a second time with my additional comment. Would it reject my second comment because its from the same name/email address/url on the same entry id?
Thanks,
Kristine
stepan
Apr 9 2003, 11:51 AM
QUOTE
I have a question though... what is being compared between the comments to reject the multiples?
All it compares is the
text of the comment - you can post multiple comments, as long as their text differs in some way.
This also means that if you post a comment and someone else posts the
exact same comment, theirs won't show up.
kadyellebee
Apr 9 2003, 11:58 AM
Ahhh, okay, that makes sense. How hard would it be to make it check for the author name in addition to the text? I know that sometimes, I get multiple people leaving a {{{hugs}}} or something basic like that in reply to my posts.
Anyhow, its just a thought

Thanks,
Kristine
stepan
Apr 9 2003, 01:29 PM
Heh, noone leaves
me {{{hugs}}}
Anyway, it would be easy, simply insert the following after the first line of the hack:
CODE
author => remove_html(scalar $q->param('author')),
You could do similar stuff for unique author email addresses and URLs. Hmm, maybe I'll change my tip to check for those as well.
kadyellebee
Apr 9 2003, 01:36 PM
Cool deal, thanks Stepan!!

Kristine
stepan
Apr 9 2003, 01:47 PM
I've changed the hack to compare comment text and author name, email and url when checking for duplicates.
The hack has moved to a different location in the Comments.pm file, so you may want to remove the original hack if you already applied it (it should work either way, though).
stepan
May 1 2003, 07:07 AM
Version 3.0 released.
The hack now works with all MT back-ends, including the DB_File database.
almuhajabah
May 1 2003, 10:04 PM
Sweet!
My problem isn't so much people clicking the "post" button repeatedly. Instead, they get a 500 error and click the "back" button, which resubmits the comment. I've managed to educate most of my regular visitors not to do this, but there are always new visitors, which means duplicate comments. Hopefully this hack will resolve the problem.
Thanks for the great work!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.