/** * Return if the specified user can view this comment * * @param \thebuggenie\core\entities\User $user A User * * @return boolean */ public function isViewableByUser(\thebuggenie\core\entities\User $user) { $can_view = false; try { // Show comment if valid user and... if ($user instanceof \thebuggenie\core\entities\User) { if (!$this->isPublic() && $user->canSeeNonPublicComments() || $this->isPublic() && $user->canViewComments() || $this->postedByUser($user->getID())) { $can_view = true; } //endif } //endif } catch (\Exception $e) { } return $can_view; }