Make WordPress Core

Opened 17 years ago

Closed 11 years ago

#9775 closed enhancement (fixed)

Duplicate comment check is too strict

Reported by: scribu Owned by: boonebgorges
Priority: normal Milestone: 4.4
Component: Comments Version: 2.7.1
Severity: normal Keywords: needs-patch
Cc: Focuses:

Description

The duplicate comment detection mechanism doesn't allow duplicate comments on the same post, even from the post author. That's not good.

The duplicate comment check should only block the new comment if there is no other comment posted between the new comment and the old comment.

Change History (18)

#1 @scribu
17 years ago

  • Summary Duplicate comment not allowed on same postImprove duplicate comment detection

#2 @scribu
17 years ago

  • Summary Improve duplicate comment detectionDuplicate comment check is too strict

#3 follow-up: @Denis-de-Bernardy
17 years ago

It would depend on the purpose.

As I understand things, its main purpose is to make sure that double clicking the publish comment button won't output two comments. Adding a unique ID for each comment, that gets passed into the comment form, and that expires upon the comment being saved, would easily defeat this (it would probably cut a lot of spam, too). The duplicate-comment check could then be rendered obsolete, in favor of redirecting to the newly published comment itself.

#4 @Denis-de-Bernardy
17 years ago

  • Milestone 2.8Future Release

punting to future, pending patch

#5 in reply to: ↑ 3 @scribu
17 years ago

Replying to Denis-de-Bernardy:

As I understand things, its main purpose is to make sure that double clicking the publish comment button won't output two comments.

Yes, I think that's it's main purpose too.

Adding a unique ID for each comment, that gets passed into the comment form, and that expires upon the comment being saved, would easily defeat this (it would probably cut a lot of spam, too). The duplicate-comment check could then be rendered obsolete, in favor of redirecting to the newly published comment itself.

The unique ID could use a mechanism similar to post-new.php that assigns a neggative ID to a post, before it is saved.

Also, this plugin implements a similar technique: http://wordpresssupplies.com/wordpress-plugins/captcha-free/

#6 follow-up: @Denis-de-Bernardy
17 years ago

it might interfere with caching plugins however.

#7 in reply to: ↑ 6 @scribu
17 years ago

Replying to Denis-de-Bernardy:

it might interfere with caching plugins however.

Not if you add it dynamically through JS. But then users with JavaScript disabled can't comment.

Therefore, I still think it's a more robust ideea to check for intermediate comments before blocking.

#8 @Denis-de-Bernardy
17 years ago

  • Type defect (bug)enhancement

#9 @caesarsgrunt
17 years ago

Why would you ever want to post two identical comments, even if there were other comments between them?

#10 @josephscott
17 years ago

I think this should be closed as invalid. Providing a way to get around the duplicate comment check is asking for problems.

#11 @skithund
17 years ago

  • Cc skithund added

How about making the duplicate check pluggable, so people (like me) could get around it with a plugin if necessary?

#12 @skithund
17 years ago

  • Keywords needs-patch removed
  • Milestone Future Release3.0
  • Resolutionfixed
  • Status newclosed
  • Version 2.7.13.0

This has been fixed by making duplicate comment check pluggable.

From #12188:
(In [13434]) Add comment_duplicate_trigger hook that is fired when a duplicate comment is detected. Fixes #12188

#13 @scribu
14 years ago

  • Milestone 3.0Awaiting Review
  • Resolution fixed
  • Status closedreopened

You can use 'comment_duplicate_trigger' only to customize the message that the user sees, after it has been decided that the comment is a dup.

Related: #21609

#14 @SergeyBiryukov
14 years ago

  • Version 3.02.7.1

#15 @SergeyBiryukov
13 years ago

#27138 was marked as a duplicate.

#16 @rachelbaker
11 years ago

  • Keywords needs-patch added
  • Milestone Awaiting ReviewFuture Release

This needs a patch if we are going to add a filter here.

#17 @boonebgorges
11 years ago

  • Milestone Future Release4.4

I agree that the duplicate check is probably stricter than it really needs to be. It's perfectly legitimate for, say, a post author to reply to multiple comments on a thread by saying "Yes" or "Thanks" or whatever.

That said, I don't know how to allow that without also allowing the double-click problem that the duplicate check was originally intended to prevent. Let's put in a filter and let people adjust as they see fit.

#18 @boonebgorges
11 years ago

  • Owner set to boonebgorges
  • Resolutionfixed
  • Status reopenedclosed

In 34536:

Introduce 'duplicate_comment_id' filter.

wp_allow_comment() disallows a comment if it matches a comment on the same
post with the same content, author email, and parent. This new filter allows
developers to circumvent or modify this logic, making the duplicate check
more or less lenient, as they see fit.

Fixes #9775.

Note: See TracTickets for help on using tickets.