Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.400 diff -u -p -r1.400 forum.module --- modules/forum/forum.module 30 May 2007 08:04:38 -0000 1.400 +++ modules/forum/forum.module 1 Jun 2007 16:30:14 -0000 @@ -734,9 +734,14 @@ function _forum_get_vid() { * * @TODO Give a better description. Not sure where this function is used yet. */ -function _forum_format($topic) { +function _forum_format($topic, $show_title = FALSE) { if ($topic && !empty($topic->timestamp)) { - return t('@time ago
by !author', array('@time' => format_interval(time() - $topic->timestamp), '!author' => theme('username', $topic))); + if (!$show_title) { + return t('@time ago
by !author', array('@time' => format_interval(time() - $topic->timestamp), '!author' => theme('username', $topic))); + } + else { + return t('!title
@time ago
by !author', array('!title' => l(truncate_utf8($topic->title, 25, TRUE, TRUE), "node/$topic->nid"), '@time' => format_interval(time() - $topic->timestamp), '!author' => theme('username', $topic))); + } } else { return t('n/a'); @@ -790,7 +795,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 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 n.type='forum' AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC"; + $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, n.nid, n.title 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 n.type='forum' 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)); @@ -799,6 +804,8 @@ function forum_get_forums($tid = 0) { $last_post->timestamp = $topic->last_comment_timestamp; $last_post->name = $topic->last_comment_name; $last_post->uid = $topic->last_comment_uid; + $last_post->nid = $topic->nid; + $last_post->title = $topic->title; } $forum->last_post = $last_post; @@ -1017,7 +1024,7 @@ function theme_forum_list($forums, $pare array('data' => $description, 'class' => 'forum'), array('data' => $forum->num_topics . ($new_topics ? '
'. l(format_plural($new_topics, '1 new', '@count new'), "forum/$forum->tid", array('fragment' => 'new')) : ''), 'class' => 'topics'), array('data' => $forum->num_posts, 'class' => 'posts'), - array('data' => _forum_format($forum->last_post), 'class' => 'last-reply'), + array('data' => _forum_format($forum->last_post, TRUE), 'class' => 'last-reply'), ), ); if ($new_topics > 0) {