From 53aa974461ea111b49d4d6d49786dff6535ba028 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Fri, 9 Oct 2020 13:19:17 +0200 Subject: [PATCH] do not require email for AP entries --- includes/rest/class-inbox.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/rest/class-inbox.php b/includes/rest/class-inbox.php index 088f8ad9..ea7ccca4 100644 --- a/includes/rest/class-inbox.php +++ b/includes/rest/class-inbox.php @@ -297,8 +297,14 @@ class Inbox { // disable flood control \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 ); + $state = \wp_new_comment( $commentdata, true ); + update_option( 'require_name_email', $option ); + // re-add flood control \add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 ); } @@ -330,8 +336,14 @@ class Inbox { // disable flood control \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 ); + $state = \wp_new_comment( $commentdata, true ); + update_option( 'require_name_email', $option ); + // re-add flood control \add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 ); }