userIsTutor($currentUser) : false) || !$onlyVisibles ) ) { $filterModerated = false; } if ($filterModerated && $thread->getForum()->isModerated() && $onlyVisibles) { $userId = $currentUser ? $currentUser->getId() : 0; $conditionModetared = 'AND p.status = 1 OR (p.status = '.CForumPost::STATUS_WAITING_MODERATION." AND p.posterId = $userId) OR (p.status = ".CForumPost::STATUS_REJECTED." AND p.poster = $userId) OR (p.status IS NULL AND p.posterId = $userId)"; } $dql = "SELECT p FROM ChamiloCourseBundle:CForumPost p WHERE p.thread = :thread AND p.cId = :course AND $conditionVisibility $conditionModetared ORDER BY p.iid $orderDirection"; return $this ->_em ->createQuery($dql) ->setParameters(['thread' => $thread, 'course' => $course]) ->getResult(); } }