query($sql); $DB->query('SELECT FOUND_ROWS()'); list($Results) = $DB->next_record(); if ($Results > $PerPage * ($Page - 1)) { $DB->set_query_id($PostIDs); $PostIDs = $DB->collect('ID'); $sql = " SELECT p.ID, p.AddedTime, p.Body, p.EditedUserID, p.EditedTime, ed.Username, p.TopicID, t.Title, t.LastPostID, l.PostID AS LastRead, t.IsLocked, t.IsSticky FROM forums_posts as p LEFT JOIN users_main AS um ON um.ID = p.AuthorID LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID JOIN forums_topics AS t ON t.ID = p.TopicID JOIN forums AS f ON f.ID = t.ForumID LEFT JOIN forums_last_read_topics AS l ON l.UserID = $UserID AND l.TopicID = t.ID WHERE p.ID IN (".implode(',', $PostIDs).') ORDER BY p.ID DESC'; $Posts = $DB->query($sql); } } else { $sql = ' SELECT SQL_CALC_FOUND_ROWS'; if ($ShowGrouped) { $sql .= ' * FROM ( SELECT'; } $sql .= ' p.ID, p.AddedTime, p.Body, p.EditedUserID, p.EditedTime, ed.Username, p.TopicID, t.Title, t.LastPostID,'; if ($UserID == $LoggedUser['ID']) { $sql .= ' l.PostID AS LastRead,'; } $sql .= " t.IsLocked, t.IsSticky FROM forums_posts as p LEFT JOIN users_main AS um ON um.ID = p.AuthorID LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID JOIN forums_topics AS t ON t.ID = p.TopicID JOIN forums AS f ON f.ID = t.ForumID LEFT JOIN forums_last_read_topics AS l ON l.UserID = $UserID AND l.TopicID = t.ID WHERE p.AuthorID = $UserID AND ((f.MinClassRead <= ".$LoggedUser['Class']; if (!empty($RestrictedForums)) { $sql .= " AND f.ID NOT IN ('$RestrictedForums')"; } $sql .= ')'; if (!empty($PermittedForums)) { $sql .= " OR f.ID IN ('$PermittedForums')"; } $sql .= ')'; if ($ShowUnread) { $sql .= ' AND ( (t.IsLocked = \'0\' OR t.IsSticky = \'1\') AND (l.PostID < t.LastPostID OR l.PostID IS NULL) ) '; } $sql .= ' ORDER BY p.ID DESC'; if ($ShowGrouped) { $sql .= ' ) AS sub GROUP BY TopicID ORDER BY ID DESC'; } $sql .= " LIMIT $Limit"; $Posts = $DB->query($sql); $DB->query('SELECT FOUND_ROWS()'); list($Results) = $DB->next_record(); $DB->set_query_id($Posts); } ?>

$Username"; } elseif ($ShowUnread) { echo "Unread post history for $Username"; } else { echo "Post history for $Username"; } ?>

No topics
next_record()) { ?>
in (New!) Subscribe  
full_format($Body)?>

« Last edited by