Plugin Directory

Changeset 3111969


Ignore:
Timestamp:
07/03/2024 10:24:56 PM (21 months ago)
Author:
kbrownkd
Message:

Skip the comment check when the comment matches the disallowed list.

Location:
akismet/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • akismet/trunk/akismet.php

    r3111933 r3111969  
    77Plugin URI: https://akismet.com/
    88Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
    9 Version: 5.3.3a8
     9Version: 5.3.3a9
    1010Requires at least: 5.8
    1111Requires PHP: 5.6.20
     
    4040}
    4141
    42 define( 'AKISMET_VERSION', '5.3.3a8' );
     42define( 'AKISMET_VERSION', '5.3.3a9' );
    4343define( 'AKISMET__MINIMUM_WP_VERSION', '5.8' );
    4444define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • akismet/trunk/class.akismet-admin.php

    r3111923 r3111969  
    534534
    535535    public static function comment_row_action( $a, $comment ) {
    536         $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true );
     536        $akismet_result  = get_comment_meta( $comment->comment_ID, 'akismet_result', true );
     537        if ( ! $akismet_result && get_comment_meta( $comment->comment_ID, 'akismet_skipped', true ) ) {
     538            $akismet_result = 'skipped'; // Akismet chose to skip the comment-check request.
     539        }
     540
    537541        $akismet_error  = get_comment_meta( $comment->comment_ID, 'akismet_error', true );
    538         $user_result    = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true);
     542        $user_result    = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true );
    539543        $comment_status = wp_get_comment_status( $comment->comment_ID );
    540544        $desc = null;
     
    679683                        case 'webhook-ham-noaction':
    680684                            $message = esc_html( __( 'Akismet cleared this comment during a recheck. It did not update the comment status because it had already been modified by another user or plugin.', 'akismet' ) );
     685                            break;
     686                        case 'akismet-skipped':
     687                            $message = esc_html( __( 'This comment was not sent to Akismet when it was submitted because it was caught by something else.', 'akismet' ) );
     688                            break;
     689                        case 'akismet-skipped-disallowed':
     690                            $message = esc_html( __( 'This comment was not sent to Akismet when it was submitted because it was caught by the comment disallowed list.', 'akismet' ) );
    681691                            break;
    682692                        default:
  • akismet/trunk/class.akismet.php

    r3111923 r3111969  
    225225        self::$last_comment_result = null;
    226226
     227        // Skip the Akismet check if the comment matches the Disallowed Keys list.
     228        if ( function_exists( 'wp_check_comment_disallowed_list' ) ) {
     229            $comment_author       = isset( $commentdata['comment_author'] ) ? $commentdata['comment_author'] : '';
     230            $comment_author_email = isset( $commentdata['comment_author_email'] ) ? $commentdata['comment_author_email'] : '';
     231            $comment_author_url   = isset( $commentdata['comment_author_url'] ) ? $commentdata['comment_author_url'] : '';
     232            $comment_content      = isset( $commentdata['comment_content'] ) ? $commentdata['comment_content'] : '';
     233            $comment_author_ip    = isset( $commentdata['comment_author_IP'] ) ? $commentdata['comment_author_IP'] : '';
     234            $comment_agent        = isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '';
     235
     236            if ( wp_check_comment_disallowed_list( $comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_ip, $comment_agent ) ) {
     237                self::set_last_comment( $commentdata );
     238                return $commentdata;
     239            }
     240        }
     241
    227242        $comment = $commentdata;
    228243
     
    428443
    429444                // normal result: true or false
    430                 if ( self::$last_comment['akismet_result'] == 'true' ) {
     445                if ( isset( self::$last_comment['akismet_result'] ) && self::$last_comment['akismet_result'] == 'true' ) {
    431446                    update_comment_meta( $comment->comment_ID, 'akismet_result', 'true' );
    432447                    self::update_comment_history( $comment->comment_ID, '', 'check-spam' );
     
    438453                        );
    439454                    }
    440                 } elseif ( self::$last_comment['akismet_result'] == 'false' ) {
     455                } elseif ( isset( self::$last_comment['akismet_result'] ) && self::$last_comment['akismet_result'] == 'false' ) {
    441456                    update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' );
    442457                    self::update_comment_history( $comment->comment_ID, '', 'check-ham' );
     
    450465                                self::update_comment_history( $comment->comment_ID, '', 'status-changed-' . $comment->comment_approved );
    451466                            }
    452                         } else if ( function_exists( 'wp_blacklist_check' ) && wp_blacklist_check( $comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent ) ) {
    453                             self::update_comment_history( $comment->comment_ID, '', 'wp-blacklisted' );
    454467                        } else {
    455468                            self::update_comment_history( $comment->comment_ID, '', 'status-changed-' . $comment->comment_approved );
    456469                        }
     470                    }
     471                } elseif ( ! isset( self::$last_comment['akismet_result'] ) ) {
     472                    // akismet_result isn't set, so the comment wasn't sent to Akismet.
     473                    update_comment_meta( $comment->comment_ID, 'akismet_skipped', 'true' );
     474                    $caught_by_disallowed_list = false;
     475
     476                    if ( function_exists( 'wp_check_comment_disallowed_list' ) ) {
     477                        $caught_by_disallowed_list = wp_check_comment_disallowed_list( $comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent );
     478                    }
     479
     480                    if ( $caught_by_disallowed_list ) {
     481                        self::update_comment_history( $comment->comment_ID, '', 'wp-disallowed' );
     482                        self::update_comment_history( $comment->comment_ID, '', 'akismet-skipped-disallowed' );
     483                    } else {
     484                        // Add a generic skipped history item.
     485                        self::update_comment_history( $comment->comment_ID, '', 'akismet-skipped' );
    457486                    }
    458487                } else {
  • akismet/trunk/readme.txt

    r3111915 r3111969  
    3737* Make setup step clearer for new users.
    3838* Remove the stats section from the configuration page if the site has been revoked from the key.
     39* Skip the Akismet comment check when the comment matches something in the disallowed list.
    3940
    4041= 5.3.2 =
Note: See TracChangeset for help on using the changeset viewer.