Filter option in favor of updating the database

This commit is contained in:
Alex Kirk 2020-10-22 21:29:14 +02:00 committed by GitHub
parent 53aa974461
commit 953cf71994
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -298,12 +298,9 @@ class Inbox {
\remove_action( 'check_comment_flood', 'check_comment_flood_db', 10 ); \remove_action( 'check_comment_flood', 'check_comment_flood_db', 10 );
// do not require email for AP entries // do not require email for AP entries
$option = get_option( 'require_name_email' ); add_filter( 'pre_option_require_name_email', '__return_false' );
update_option( 'require_name_email', 0 );
$state = \wp_new_comment( $commentdata, true ); $state = \wp_new_comment( $commentdata, true );
remove_filter( 'pre_option_require_name_email', '__return_false' );
update_option( 'require_name_email', $option );
// re-add flood control // re-add flood control
\add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 ); \add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 );
@ -337,12 +334,9 @@ class Inbox {
\remove_action( 'check_comment_flood', 'check_comment_flood_db', 10 ); \remove_action( 'check_comment_flood', 'check_comment_flood_db', 10 );
// do not require email for AP entries // do not require email for AP entries
$option = get_option( 'require_name_email' ); add_filter( 'pre_option_require_name_email', '__return_false' );
update_option( 'require_name_email', 0 );
$state = \wp_new_comment( $commentdata, true ); $state = \wp_new_comment( $commentdata, true );
remove_filter( 'pre_option_require_name_email', '__return_false' );
update_option( 'require_name_email', $option );
// re-add flood control // re-add flood control
\add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 ); \add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 );