diff options
author | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-03-24 10:13:10 +0000 |
---|---|---|
committer | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-03-24 10:13:10 +0000 |
commit | 717d6e30c5f2fd6d8c55239a4af50b4b76b140b4 (patch) | |
tree | 3f7e44bb7960919bf8f4bc960e8f7f898143fe24 | |
parent | ae5a0b9aa948710ea0663e211a36d175df4a2350 (diff) | |
download | brdo-717d6e30c5f2fd6d8c55239a4af50b4b76b140b4.tar.gz brdo-717d6e30c5f2fd6d8c55239a4af50b4b76b140b4.tar.bz2 |
#54098, forum "last post" column show oldest, not most recent, patch by Zen.
-rw-r--r-- | modules/forum.module | 6 | ||||
-rw-r--r-- | modules/forum/forum.module | 6 |
2 files changed, 2 insertions, 10 deletions
diff --git a/modules/forum.module b/modules/forum.module index 6b0038427..937e09ac1 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -663,10 +663,6 @@ function _forum_format($topic) { */ function forum_get_forums($tid = 0) { - if (!$tid) { - $tid = 0; - } - $forums = array(); $_forums = taxonomy_get_tree(variable_get('forum_nav_vocabulary', ''), $tid); @@ -699,7 +695,7 @@ function forum_get_forums($tid = 0) { // This query does not use full ANSI syntax since MySQL 3.x does not support // table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria // used to join node_comment_statistics to users. - $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 != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {forum} f ON n.vid = f.vid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid WHERE n.status = 1 AND r.tid = %d"; + $sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {term_node} tn ON n.nid = tn.nid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN users u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC"; $sql = db_rewrite_sql($sql); $topic = db_fetch_object(db_query_range($sql, $forum->tid, 0, 1)); diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 6b0038427..937e09ac1 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -663,10 +663,6 @@ function _forum_format($topic) { */ function forum_get_forums($tid = 0) { - if (!$tid) { - $tid = 0; - } - $forums = array(); $_forums = taxonomy_get_tree(variable_get('forum_nav_vocabulary', ''), $tid); @@ -699,7 +695,7 @@ function forum_get_forums($tid = 0) { // This query does not use full ANSI syntax since MySQL 3.x does not support // table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria // used to join node_comment_statistics to users. - $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 != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {forum} f ON n.vid = f.vid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid WHERE n.status = 1 AND r.tid = %d"; + $sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {term_node} tn ON n.nid = tn.nid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN users u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC"; $sql = db_rewrite_sql($sql); $topic = db_fetch_object(db_query_range($sql, $forum->tid, 0, 1)); |