Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/apppresser/AppPresser
Browse files Browse the repository at this point in the history
  • Loading branch information
scottopolis committed Jan 14, 2021
2 parents d747ef0 + 38716a2 commit 5b1117f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apppresser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 10 additions & 0 deletions inc/AppPresser_Extend_Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 5b1117f

Please sign in to comment.