Skip to:
Content

Opened 3 years ago

Closed 3 months ago

#2917 closed enhancement (fixed)

add filter to skip Akismet spam check

Reported by: tharsheblows Owned by: johnjamesjacoby
Milestone: 2.6 Priority: high
Severity: major Version: 2.1
Component: Extend - Akismet Keywords: has-patch commit
Cc:

Description

One of my users is repeatedly getting sent to spam for no reason. Instead of catching that and then re-submitting as a false positive so she doesn't get stuck with Akismet thinking she's a spammer and it affecting her on other sites, I want to skip the check for her altogether.

This filter allows for development of a whitelist plugin or function which can be used to skip the Akismet checks.

Attachments (2)

2917.diff (509 bytes) - added by tharsheblows 3 years ago.
add filter to skip Akismet check on more granular level
2917.patch (3.3 KB) - added by johnjamesjacoby 3 months ago.

Download all attachments as: .zip

Change History (7)

@tharsheblows
3 years ago

add filter to skip Akismet check on more granular level

#1 @thebrandonallen
3 years ago

  • Keywords reporter-feedback added; dev-feedback removed
  • Milestone changed from Awaiting Review to Under Consideration

I think this makes sense, but you could probably achieve the same results by adding our own filter on the *_pre_insert hooks with a priority of 0, running a check there for the user in questions, and then remove the Akismet hook.

Can you try this, and report back if it works?

#2 @johnjamesjacoby
20 months ago

  • Keywords needs-refresh added; needs-unit-tests reporter-feedback removed
  • Milestone changed from Under Consideration to 2.7
  • Owner set to johnjamesjacoby

This should be easily achievable, so let’s make sure it is soon.

#3 @johnjamesjacoby
3 months ago

  • Keywords commit added; needs-refresh removed
  • Milestone changed from 2.7 to 2.6
  • Priority changed from normal to high
  • Severity changed from normal to major
  • Version set to 2.1

We have an immediate need on the WordPress.org network to ensure that moderators, per-forum moderators, and other types of trusted users are able to bypass Akismet, so I'm bumping this into 2.6.

Patch & commit imminent.

#4 @johnjamesjacoby
3 months ago

Revised patch does the following:

  • Adds bbp_bypass_check_for_spam filter ahead of the HTTP request
  • Adds bbp_bypass_spam_enforcement filter ahead of post_status switch
  • Adds current_user_can( 'moderate' ) check to bypass spam enforcement
  • Adds parse_response() method to BBP_Akismet class for future abstraction

This allows for 2 different ways to short-circuit Akismet:

  • Before the HTTP request even happens
  • After the HTTP request but before the status change

bbPress will now trust users that pass the moderator capability check (including per-forum moderators) even if Akismet thinks the content is spammy. The Akismet history will still reflect the catch; the status will just not be enforced.

This addresses issues we've seen on WordPress.org, BuddyPress.org, and bbPress.org, where trusted moderator posts would be caught in the spam queue, even when they have privileges to enter the queue and unspam their own posts.

Whether moderators should require other moderators to approve their posts is outside the scope of this ticket. The general consensus at this time is "that is too much friction" but if that changes, we can adjust this.

#5 @johnjamesjacoby
3 months ago

  • Resolution set to fixed
  • Status changed from new to closed

In 6874:

Akismet: allow "trusted" users to bypass spam post_status enforcement.

  • Adds bbp_bypass_check_for_spam filter ahead of the HTTP request
  • Adds bbp_bypass_spam_enforcement filter ahead of post_status switch
  • Adds current_user_can( 'moderate' ) check to bypass spam enforcement
  • Adds parse_response() method to BBP_Akismet class for future abstraction

This allows for 2 different ways to short-circuit Akismet:

  • Before the HTTP request happens
  • After the HTTP request, but before the status change

bbPress will now trust users that pass the moderator capability check (including per-forum moderators) even if Akismet thinks the content is spammy. The Akismet history will still reflect the catch; the status will just not be enforced.

This addresses issues we've seen on WordPress.org, BuddyPress.org, and bbPress.org, where trusted moderator posts would be caught in the spam queue, even when they have privileges to enter the queue and unspam their own posts.

Fixes #2917. Props tharsheblows for the original patch!

Note: See TracTickets for help on using tickets.