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 );
// do not require email for AP entries
$option = get_option( 'require_name_email' );
update_option( 'require_name_email', 0 );
add_filter( 'pre_option_require_name_email', '__return_false' );
$state = \wp_new_comment( $commentdata, true );
update_option( 'require_name_email', $option );
remove_filter( 'pre_option_require_name_email', '__return_false' );
// re-add flood control
\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 );
// do not require email for AP entries
$option = get_option( 'require_name_email' );
update_option( 'require_name_email', 0 );
add_filter( 'pre_option_require_name_email', '__return_false' );
$state = \wp_new_comment( $commentdata, true );
update_option( 'require_name_email', $option );
remove_filter( 'pre_option_require_name_email', '__return_false' );
// re-add flood control
\add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 );