Skip to:
Content

bbPress.org

Changeset 7356


Ignore:
Timestamp:
11/14/2025 11:30:00 PM (4 weeks ago)
Author:
johnjamesjacoby
Message:

Akismet: improve verbiage in history log items.

When Akismet catches spam for moderators, and moderators are able to bypass spam, a second log entry is inserted into the history to explain why, and the previous verbiage was not very clear.

This commit attempts to provide some clarity, while also respecting that this specific code is filterable, and that the spam recommendation could be overruled by third-party plugins for any reason.

This commit also adds some hooks by request, and improves some related code docs.

Props johnjamesjacoby, r-a-y, sirlouen.

In trunk, for 2.7.

See r7353. Fixes #3434.

File:
1 edited

Legend:

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

    r7352 r7356  
    248248        if ( 'true' === $post_data['bbp_akismet_result'] ) {
    249249
    250             // Let plugins do their thing
    251             do_action( 'bbp_akismet_spam_caught' );
     250            /**
     251             * Hook that fires after Akismet has caught a post as spammy and
     252             * immediately before its status is set to spam.
     253             *
     254             * @since 2.0.0 bbPress (r3308)
     255             *
     256             * @param array $post_data Post data.
     257             */
     258            do_action( 'bbp_akismet_spam_caught', $post_data );
    252259
    253260            // Set post_status to spam
     
    559566        if ( is_object( $_post ) && ! empty( $this->last_post ) && is_array( $as_submitted ) ) {
    560567
     568            /**
     569             * Fires immediately before post meta is updated on a bbPress post
     570             * that Akismet has checked.
     571             *
     572             * @since 2.7.0 bbPress (r7355)
     573             *
     574             * @param int $post_id
     575             * @param object $_post
     576             */
     577            do_action( 'bbp_akismet_before_update_post_meta', $post_id, $_post );
     578
    561579            // Get user data
    562580            $userdata       = get_userdata( $_post->post_author );
     
    602620                    $this->update_post_history(
    603621                        $post_id,
    604                         esc_html__( 'Akismet caught this post as spam', 'bbpress' ),
     622                        esc_html__( 'Akismet caught this post as spam.', 'bbpress' ),
    605623                        'check-spam'
    606624                    );
     
    611629                            $post_id,
    612630                            sprintf(
    613                                 esc_html__( 'Post status was changed to %s', 'bbpress' ),
     631                                esc_html__( 'Akismet overruled. Post status overridden to %s.', 'bbpress' ),
    614632                                $_post->post_status
    615633                            ),
     
    625643                    $this->update_post_history(
    626644                        $post_id,
    627                         esc_html__( 'Akismet cleared this post as not spam', 'bbpress' ),
     645                        esc_html__( 'Akismet cleared this post as not spam.', 'bbpress' ),
    628646                        'check-ham'
    629647                    );
     
    634652                            $post_id,
    635653                            sprintf(
    636                                 esc_html__( 'Post status was changed to %s', 'bbpress' ),
     654                                esc_html__( 'Akismet overruled. Post status overridden to %s.', 'bbpress' ),
    637655                                $_post->post_status
    638656                            ),
     
    664682                }
    665683            }
     684
     685            /**
     686             * Fires immediately after post meta is updated on a bbPress post
     687             * that Akismet has checked.
     688             *
     689             * @since 2.7.0 bbPress (r7355)
     690             *
     691             * @param int $post_id
     692             * @param object $_post
     693             */
     694            do_action( 'bbp_akismet_after_update_post_meta', $post_id, $_post );
    666695        }
    667696    }
     
    671700     *
    672701     * @since 2.0.0 bbPress (r3308)
     702     * @since 2.7.0 bbPress (r7355) Changed from private to public.
    673703     *
    674704     * @param int $post_id
     
    676706     * @param string $event
    677707     */
    678     private function update_post_history( $post_id = 0, $message = null, $event = null ) {
     708    public function update_post_history( $post_id = 0, $message = null, $event = null ) {
    679709
    680710        // Define local variable(s)
Note: See TracChangeset for help on using the changeset viewer.