Make WordPress Core

Opened 20 years ago

Closed 20 years ago

Last modified 10 years ago

#733 closed defect (bug) (wontfix)

check_comment is too rigid

Reported by: skippy's profile skippy Owned by: matt's profile matt
Milestone: Priority: normal
Severity: minor Version: 1.2.2
Component: Administration Keywords:
Focuses: Cc:

Description

The function check_comment immediately returns a false value if manual moderation is in effect. This severely limits the usability of this function in plugins designed to work with or without manual moderation.

Change History (9)

#1 @skippy
20 years ago

  • Patch set to No

#2 @matt
20 years ago

  • Owner changed from anonymous to matt
  • Resolution changed from 10 to 20
  • Status changed from new to closed

Plugins should use pre_comment_approved, check_comment doesn't matter to plugins.

#3 @matt
20 years ago

  • Resolution changed from 20 to 70

#4 @skippy
20 years ago

  • Resolution changed from 70 to 30
  • Status changed from closed to assigned

Telling me to use an undocumented function[1] does not resolve this bug. The check_comment() function is useless even in a pre_comment_approved() action/filter because manual moderation will cause check_comment() to always flag a comment as spam.

As it stands, plugins must duplicate this code in order to perform this check. That's rather wasteful.

1: I searched both the codex and the wiki for pre_comment_approved():

http://codex.wordpress.org/Special:Search?search=pre_comment&go=Go
http://wiki.wordpress.org/?pagename=FullTextSearch&s=pre_comment

Nothing. I grepped my 1.2.2 source for pre_comment and got no results.

#5 @skippy
20 years ago

Okay, I re-read what Matt said, and I realize now that he's discouraging check_comment() in plugins altogether. I think plugins should be able to use check_comment() so that a plugin can easily check moderation keys without duplicating code.

#6 @matt
20 years ago

I was referring to 1.5 as well, which has significantly more hooks. Manual moderation doesn't matter because plugins get to everything after that, with the pre_comment_approved filter. A grep for do_action and apply_filters on the 1.5 source should be self-documenting for most plugin authors.

#7 @skippy
20 years ago

Why would you refer to 1.5 without clarifying that you're doing so, when I filed this bug against 1.2.2?

Manual moderation, when in effect, will cause check_comment() to always register a comment as spam, because the very first thing check_comment() does is to see if manual moderation is activated.

Maybe my intended use of check_comment() will help illustrate why I want this function available to plugins:
My 'comment authorization by email' plugin sends comment authors an email with a link that allows them to self-approve their comment. The theory is that a real human being will supply a valid email address which will receive the moderation email. Spammers and trolls will supply bogus emails, and thus never receive the moderation email.

At least one user has explained to me that a troll is abusing her site, by using a valid email and moderating his own comments. I would like for her to be able to simply drop the troll's email address into her moderation keys, and my plugin can execute check_comment() to determine whether WordPress would _normally_ allow or disallow the comment. This way no legitimate users are penalized, and the site admin can review the troll's comments to selectively moderate them as she see's fit.

But since check_comment() checks manual moderation, and since my plugin currently requires manual moderation, my plugin is told that every comment is spam if it calls check_comment(). For the short term, I've copied the logic of check_comment() into the body of my plugin, but that seems to me to be a waste of a function: check_comment() can easily be made available to all plugins with the removal of a single line.

Rather than discuss check_comment() itself, your comments have consistently been on how I'm calling it. That's missing the point of this bug report.

#8 @matt
20 years ago

  • Resolution changed from 30 to 90
  • Status changed from assigned to closed

This ticket was mentioned in Slack in #polyglots by zedejose. View the logs.


10 years ago

Note: See TracTickets for help on using tickets.