@@ -879,7 +879,6 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
->addTag('node_access')
->orderBy('f.sticky','DESC')
->orderByHeader($forum_topic_list_header)
->orderBy('f.last_comment_timestamp','DESC')
->limit($forum_per_page);
$count_query=db_select('forum_index','f');
...
...
@@ -894,7 +893,29 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
$nids[]=$record->nid;
}
if($nids){
$result=db_query("SELECT n.title, n.nid, n.type, n.sticky, n.created, n.uid, n.comment AS comment_mode, ncs.*, f.tid AS forum_tid, u.name, CASE ncs.last_comment_uid WHEN 0 THEN ncs.last_comment_name ELSE u2.name END AS last_comment_name FROM {node} n INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {forum} f ON n.vid = f.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {users} u2 ON ncs.last_comment_uid = u2.uid WHERE n.nid IN (:nids)",array(':nids'=>$nids));