// 1. Add first post of topic if it pinned and page of topic not first
$first_post = false;
if ($t_data['topic_show_first_post'] && $start)
{
$first_post = DB()->fetch_rowset("
SELECT
u.username, u.user_id, u.user_rank, u.user_posts, u.user_from,
u.user_regdate, u.user_sig,
u.user_avatar, u.user_avatar_type,
u.user_opt, u.user_gender, u.user_birthday,
p.*,
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text
FROM ". BB_POSTS ." p
LEFT JOIN ". BB_USERS ." u ON(u.user_id = p.poster_id)
LEFT JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id)
LEFT JOIN ". BB_POSTS_HTML ." h ON(h.post_id = p.post_id)
WHERE
p.post_id = {$t_data['topic_first_post_id']}
LIMIT 1
");
}
u.user_status,
// 2. All others posts
$sql = "
SELECT
u.username, u.user_id, u.user_rank, u.user_posts, u.user_from,
u.user_regdate, u.user_sig,
u.user_avatar, u.user_avatar_type,
u.user_opt, u.user_gender, u.user_birthday,
p.*,
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text
FROM ". BB_POSTS ." p
LEFT JOIN ". BB_USERS ." u ON(u.user_id = p.poster_id)
LEFT JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id)
LEFT JOIN ". BB_POSTS_HTML ." h ON(h.post_id = p.post_id)
WHERE
p.topic_id = $topic_id
$limit_posts_time
GROUP BY
p.post_id
ORDER BY
p.post_time
$post_order
LIMIT
$start, $posts_per_page
";
u.user_status,
$template->assign_block_vars('postrow', array(
'USER_STATUS' => $postrow[$i]['user_status'],
<!-- IF postrow.POSTER_RANK --><p class="rank_txt">{postrow.POSTER_RANK}</p><!-- ENDIF -->
<p class="rank_txt">{postrow.USER_STATUS}</p>