if (isset($LoggedUser['PostsPerPage'])) { $PerPage = $LoggedUser['PostsPerPage']; } else { $PerPage = POSTS_PER_PAGE; } //We have to iterate here because if one is empty it breaks the query $TopicIDs = array(); foreach($Forums as $Forum) { if (!empty($Forum['LastPostTopicID'])) { $TopicIDs[]=$Forum['LastPostTopicID']; } } //Now if we have IDs' we run the query if(!empty($TopicIDs)) { $DB->query("SELECT l.TopicID, l.PostID, CEIL((SELECT COUNT(ID) FROM forums_posts WHERE forums_posts.TopicID = l.TopicID AND forums_posts.ID<=l.PostID)/$PerPage) AS Page FROM forums_last_read_topics AS l WHERE TopicID IN(".implode(',',$TopicIDs).") AND UserID='$LoggedUser[ID]'"); $LastRead = $DB->to_array('TopicID', MYSQLI_ASSOC); } else { $LastRead = array(); } View::show_header('Forums'); ?>
Forum | Last post | Topics | Posts | ||||
=display_str($ForumName)?> |
if ($NumPosts == 0) { ?>
There are no topics here=($MinCreate <= $LoggedUser['Class']) ? ', '.'create one'.'' : ''?>. | } else { ?>=display_str(Format::cut_string($LastTopic, 50, 1))?> if (!empty($LastRead[$LastTopicID])) { ?> } ?> by =Users::format_username($LastAuthorID, false, false, false)?> =time_diff($LastTime,1)?> | =number_format($NumTopics)?> | =number_format($NumPosts)?> | } ?>