mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@48207 git-svn-id: http://core.svn.wordpress.org/trunk@47976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8d7a19cdc2
commit
8c721c9c34
@ -870,8 +870,7 @@ function check_comment_flood_db() {
|
||||
* @param string $email Comment author's email address.
|
||||
* @param string $date MySQL time string.
|
||||
* @param bool $avoid_die When true, a disallowed comment will result in the function
|
||||
* returning a WP_Error object, rather than executing wp_die().
|
||||
* Default false.
|
||||
* returning without executing wp_die() or die(). Default false.
|
||||
* @return bool Whether comment flooding is occurring.
|
||||
*/
|
||||
function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) {
|
||||
@ -887,6 +886,7 @@ function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = fal
|
||||
if ( current_user_can( 'manage_options' ) || current_user_can( 'moderate_comments' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$hour_ago = gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS );
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
@ -903,10 +903,13 @@ function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = fal
|
||||
$user,
|
||||
$email
|
||||
);
|
||||
|
||||
$lasttime = $wpdb->get_var( $sql );
|
||||
|
||||
if ( $lasttime ) {
|
||||
$time_lastcomment = mysql2date( 'U', $lasttime, false );
|
||||
$time_newcomment = mysql2date( 'U', $date, false );
|
||||
|
||||
/**
|
||||
* Filters the comment flood status.
|
||||
*
|
||||
@ -917,6 +920,7 @@ function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = fal
|
||||
* @param int $time_newcomment Timestamp of when the new comment was posted.
|
||||
*/
|
||||
$flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment );
|
||||
|
||||
if ( $flood_die ) {
|
||||
/**
|
||||
* Fires before the comment flood message is triggered.
|
||||
@ -928,7 +932,7 @@ function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = fal
|
||||
*/
|
||||
do_action( 'comment_flood_trigger', $time_lastcomment, $time_newcomment );
|
||||
|
||||
if ( true === $avoid_die ) {
|
||||
if ( $avoid_die ) {
|
||||
return true;
|
||||
} else {
|
||||
/**
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48206';
|
||||
$wp_version = '5.5-alpha-48207';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user