Make WordPress Core


Ignore:
Timestamp:
06/28/2020 09:40:54 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Correct description for the $avoid_die parameter of wp_check_comment_flood().

The function always return a boolean value, never a WP_Error object.

See #49572, #39732.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r48199 r48207  
    871871 * @param string $date      MySQL time string.
    872872 * @param bool   $avoid_die When true, a disallowed comment will result in the function
    873  *                          returning a WP_Error object, rather than executing wp_die().
    874  *                          Default false.
     873 *                          returning without executing wp_die() or die(). Default false.
    875874 * @return bool Whether comment flooding is occurring.
    876875 */
     
    888887                return false;
    889888        }
     889
    890890        $hour_ago = gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS );
    891891
     
    898898        }
    899899
    900         $sql      = $wpdb->prepare(
     900        $sql = $wpdb->prepare(
    901901                "SELECT `comment_date_gmt` FROM `$wpdb->comments` WHERE `comment_date_gmt` >= %s AND ( $check_column = %s OR `comment_author_email` = %s ) ORDER BY `comment_date_gmt` DESC LIMIT 1",
    902902                $hour_ago,
     
    904904                $email
    905905        );
     906
    906907        $lasttime = $wpdb->get_var( $sql );
     908
    907909        if ( $lasttime ) {
    908910                $time_lastcomment = mysql2date( 'U', $lasttime, false );
    909911                $time_newcomment  = mysql2date( 'U', $date, false );
     912
    910913                /**
    911914                 * Filters the comment flood status.
     
    918921                 */
    919922                $flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment );
     923
    920924                if ( $flood_die ) {
    921925                        /**
     
    929933                        do_action( 'comment_flood_trigger', $time_lastcomment, $time_newcomment );
    930934
    931                         if ( true === $avoid_die ) {
     935                        if ( $avoid_die ) {
    932936                                return true;
    933937                        } else {
Note: See TracChangeset for help on using the changeset viewer.