Filter option in favor of updating the database
This commit is contained in:
parent
53aa974461
commit
953cf71994
1 changed files with 4 additions and 10 deletions
|
@ -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 );
|
||||||
|
|
Loading…
Reference in a new issue