diff --git a/apppresser.php b/apppresser.php index 9d14dbb..95f3b97 100644 --- a/apppresser.php +++ b/apppresser.php @@ -181,7 +181,10 @@ public function load_license_update_checks() { public function login_user_from_iframe() { if (class_exists('Jwt_Auth_Public')) { - if (isset($_REQUEST['appp']) && ((int) $_REQUEST['appp'] === 3) && isset($_REQUEST['token'])) { + $appp3Exists = isset($_REQUEST['appp']) && ((int) $_REQUEST['appp'] === 3); + $restExists = isset($_REQUEST['rest']) && ($_REQUEST['rest'] === 'true'); + $tokenExists = isset($_REQUEST['token']); + if (($appp3Exists || $restExists) && $tokenExists) { $userId = $this->_getUserIdFromToken($_REQUEST['token']); // Login the user that we retrieved from token, if exists if ($userId) { diff --git a/inc/AppPresser_Extend_Comments.php b/inc/AppPresser_Extend_Comments.php index 5eef257..51af065 100644 --- a/inc/AppPresser_Extend_Comments.php +++ b/inc/AppPresser_Extend_Comments.php @@ -10,11 +10,21 @@ public function __construct() public function hooks() { + add_filter('rest_allow_anonymous_comments', array($this, 'filter_rest_allow_anonymous_comments')); + if (isset($_REQUEST['children']) && ($_REQUEST['children'] === 'true')) { add_action('rest_api_init', array($this, 'add_children_field_to_comment_endpoint')); } } + /** + * Allow adding anonymous comments from API + */ + public function filter_rest_allow_anonymous_comments() + { + return true; + } + /** * Add children field in the comment endpoint */