|
|
Administrator
|
Posts: 1223
Join Date: Mar 2005
|
|
You can do it very easily. In board.php replace this code: Code:
if (count($userprivateforums)==0)
$result = mysql_query("SELECT topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics ORDER BY topic_lastpost_time DESC LIMIT $shownumlastposts");
else
{
$where = 'WHERE forum_id<>'.implode(' AND forum_id<>', $userprivateforums);
$result = mysql_query("SELECT topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics $where ORDER BY topic_lastpost_time DESC LIMIT $shownumlastposts");
}
by this code Code:
if (count($userprivateforums)==0)
$result = mysql_query("SELECT topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics ORDER BY topic_sticky DESC, topic_lastpost_time DESC LIMIT $shownumlastposts");
else
{
$where = 'WHERE forum_id<>'.implode(' AND forum_id<>', $userprivateforums);
$result = mysql_query("SELECT topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics $where ORDER BY topic_sticky DESC, topic_lastpost_time DESC LIMIT $shownumlastposts");
}
Basically you add "topic_sticky DESC" to the order by statement.
That will show sticky topics on the top. If you want to include the sticky, moved etc. prefixes you need to add this code:Code:
$topic_ind = array ();
if ($sticky == 1)
array_push($topic_ind, $lang['sticky']);
if ($moved == 1)
array_push($topic_ind, $lang['moved']);
if ($locked == 1)
array_push($topic_ind, $lang['locked']);
if (!empty($topic_ind))
$topic_link .= ' <sup>'.implode(', ',$topic_ind).'</sup>';
Just compare the code of board.php and vforum.php to see all the difference.
|