/** * Check if the current request is authenticated * * @return bool */ public function is_authenticated($postId = null) { if (!$postId) { $postId = get_the_ID(); } $this->service = $this->get_oauth_service(); if ($user = $this->get_wa_user()) { if ($postId && !PostMetaBox::post_is_unlocked($postId)) { $postRequiredRole = PostMetaBox::post_required_role($postId); if (!empty($postRequiredRole) && !in_array($postRequiredRole, $user->roles)) { return false; } } return true; } return false; }