Skip to content

Commit 5d7ad7f

Browse files
committed
use "pre_option_require_name_email" filter instead of "check_comment_flood"
thanks @akirk
1 parent e7c0526 commit 5d7ad7f

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

includes/rest/class-inbox.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,12 @@ public static function handle_reaction( $object, $user_id ) {
302302
),
303303
);
304304

305-
// disable flood control
306-
\remove_action( 'check_comment_flood', 'check_comment_flood_db', 10 );
307-
308305
// do not require email for AP entries
309-
add_filter( 'pre_option_require_name_email', '__return_false' );
306+
\add_filter( 'pre_option_require_name_email', '__return_false' );
307+
310308
$state = \wp_new_comment( $commentdata, true );
311-
remove_filter( 'pre_option_require_name_email', '__return_false' );
312309

313-
// re-add flood control
314-
\add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 );
310+
\remove_filter( 'pre_option_require_name_email', '__return_false' );
315311
}
316312

317313
/**
@@ -338,15 +334,11 @@ public static function handle_create( $object, $user_id ) {
338334
),
339335
);
340336

341-
// disable flood control
342-
\remove_action( 'check_comment_flood', 'check_comment_flood_db', 10 );
343-
344337
// do not require email for AP entries
345-
add_filter( 'pre_option_require_name_email', '__return_false' );
338+
\add_filter( 'pre_option_require_name_email', '__return_false' );
339+
346340
$state = \wp_new_comment( $commentdata, true );
347-
remove_filter( 'pre_option_require_name_email', '__return_false' );
348341

349-
// re-add flood control
350-
\add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 );
342+
\remove_filter( 'pre_option_require_name_email', '__return_false' );
351343
}
352344
}

0 commit comments

Comments
 (0)