Skip to:
Content

bbPress.org

Changeset 7197


Ignore:
Timestamp:
04/26/2021 07:28:21 PM (4 months ago)
Author:
johnjamesjacoby
Message:

Akismet: trust x-akismet-pro-tip response header.

This commit discards forums, topics, and replies that Akismet is 100% sure are spammy.

The redirection experience is intentionally nondescript at this time.

In trunk for 2.7.0. See #2853.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/extend/akismet.php

    r7196 r7197  
    209209        if ( apply_filters( 'bbp_bypass_spam_enforcement', $skip_spam, $post_data ) ) {
    210210            return $post_data;
     211        }
     212
     213        // Discard obvious spam
     214        if ( get_option( 'akismet_strictness' ) ) {
     215
     216            // Akismet is 100% confident this is spam
     217            if (
     218                ! empty( $post_data['bbp_akismet_result_headers']['x-akismet-pro-tip'] )
     219                &&
     220                ( 'discard' === $post_data['bbp_akismet_result_headers']['x-akismet-pro-tip'] )
     221            ) {
     222
     223                // URL to redirect to (current, or forum root)
     224                $redirect_to = ( ! empty( $_SERVER['HTTP_HOST'] ) && ! empty( $_SERVER['REQUEST_URI'] ) )
     225                    ? bbp_get_url_scheme() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']
     226                    : bbp_get_root_url();
     227
     228                // Do the redirect (post data not saved!)
     229                bbp_redirect( $redirect_to );
     230            }
    211231        }
    212232
Note: See TracChangeset for help on using the changeset viewer.