From 0f15f59f97d2cd0a51de5ef78e4ce8d4ae6f470e Mon Sep 17 00:00:00 2001 From: blackcoder87 Date: Tue, 8 Sep 2020 14:50:16 +0200 Subject: [PATCH] Fix post visits was shown instead of topic visits --- application/modules/forum/mappers/Topic.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/modules/forum/mappers/Topic.php b/application/modules/forum/mappers/Topic.php index 3f4b4d0e7..d96e16c9d 100644 --- a/application/modules/forum/mappers/Topic.php +++ b/application/modules/forum/mappers/Topic.php @@ -15,7 +15,7 @@ class Topic extends \Ilch\Mapper { public function getTopicsByForumId($id, $pagination = NULL) { - $sql = 'SELECT SQL_CALC_FOUND_ROWS *, topics.id, MAX(posts.date_created) AS latest_post + $sql = 'SELECT SQL_CALC_FOUND_ROWS *, topics.id, topics.visits, MAX(posts.date_created) AS latest_post FROM `[prefix]_forum_topics` AS topics LEFT JOIN `[prefix]_forum_posts` AS posts ON topics.id = posts.topic_id WHERE topics.forum_id = '.(int)$id.' @@ -24,10 +24,10 @@ public function getTopicsByForumId($id, $pagination = NULL) if (!empty($pagination)) { $sql .= ' LIMIT '.implode(',',$pagination->getLimit()); - $fileArray = $this->db()->queryArray($sql); + $topicArray = $this->db()->queryArray($sql); $pagination->setRows($this->db()->querycell('SELECT FOUND_ROWS()')); } else { - $fileArray = $this->db()->queryArray($sql); + $topicArray = $this->db()->queryArray($sql); } $entry = []; @@ -35,7 +35,7 @@ public function getTopicsByForumId($id, $pagination = NULL) $dummyUser = null; $userCache = []; - foreach ($fileArray as $entries) { + foreach ($topicArray as $entries) { $entryModel = new TopicModel(); $userMapper = new UserMapper(); $entryModel->setId($entries['id']);