summaryrefslogtreecommitdiff
path: root/modules/forum
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-10-01 13:30:06 +0000
committerDries Buytaert <dries@buytaert.net>2005-10-01 13:30:06 +0000
commit9981e4326d96d5f06e269134ea43b4dc61d73b1b (patch)
treed79878b0b7e8d81beececedb85714f800c9fccd2 /modules/forum
parentc8c2fedc7e8f3ba2bd0d534b33a94c1962000b44 (diff)
downloadbrdo-9981e4326d96d5f06e269134ea43b4dc61d73b1b.tar.gz
brdo-9981e4326d96d5f06e269134ea43b4dc61d73b1b.tar.bz2
- Patch #32459 by beardedstoat and tostinni: always add a secondary sort order so the newest comments are on top.
Diffstat (limited to 'modules/forum')
-rw-r--r--modules/forum/forum.module1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 93f735e36..42aa877ad 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -715,6 +715,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
$sql = db_rewrite_sql("SELECT n.nid, f.tid, n.title, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments FROM {node} n, {node_comment_statistics} l, {users} cu, {term_node} r, {users} u, {forum} f WHERE n.status = 1 AND l.last_comment_uid = cu.uid AND n.nid = l.nid AND n.nid = r.nid AND r.tid = %d AND n.uid = u.uid AND n.vid = f.vid");
$sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,');
+ $sql .= ', n.created DESC'; // Always add a secondary sort order so that the news forum topics are on top.
$sql_count = db_rewrite_sql("SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.type = 'forum'");