From a6c8b10d8e07075f2bbab81d3d972f3175ebe3ee Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 11 Nov 2002 20:59:28 +0000 Subject: Applied Moshe's patches: - Adds more title info to each line in the block: now showing author and number of comments in a unified way accross all modules. - Added pager support to blog module. - Blog module now uses standard node view, not its own hack which is more theme friendly (http://www.drupal.org/node.php?id=133). - Blog module now uses node_feed() function for making RSS feeds. since all feeds are now consolidated, a couple tweaks to node_feed() and format_rss_* would lead us to support new RSS formats easily. - Fixed bugs where unpublished entries were displayed. --- modules/forum.module | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'modules/forum.module') diff --git a/modules/forum.module b/modules/forum.module index 81308d5dd..46dacdded 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -97,23 +97,14 @@ function forum_block($op = "list", $delta = 0) { if (!$content) { unset($items); - $result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.type = 'forum' AND n.nid = f.nid AND f.shadow = 0 AND n.status = 1 GROUP BY n.nid ORDER BY sort DESC LIMIT ". variable_get("forum_block_num", "5")); - while ($node = db_fetch_object($result)) { - $items[] = l(check_output($node->title), array("id" => $node->nid), "node", "", array("title" => substr(strip_tags($node->body), 0, 100)."...")); - } - $content .= theme_invoke("theme_item_list", $items, t("Active forum topics:")); - + $content = node_title_list(db_query("SELECT n.nid, n.title, u.name, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'forum' AND n.nid = f.nid AND f.shadow = 0 AND n.status = 1 GROUP BY n.nid ORDER BY sort DESC LIMIT ". variable_get("forum_block_num", "5")), t("Active forum topics:")); $content .= "
"; unset ($items); - $result = db_query("SELECT n.nid, n.title, n.body FROM node n LEFT JOIN forum f ON n.nid = f.nid WHERE n.type = 'forum' ORDER BY n.nid DESC LIMIT ". variable_get("forum_block_num", "5")); - while ($node = db_fetch_object($result)) { - $items[] = l(check_output($node->title), array("id" => $node->nid), "node", "", array("title" => substr(strip_tags($node->body), 0, 100)."...")); - } - $content .= theme_invoke("theme_item_list", $items, t("New forum topics:")); + $content .= node_title_list(db_query("SELECT n.nid, n.title, u.name FROM node n LEFT JOIN forum f ON n.nid = f.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'forum' ORDER BY n.nid DESC LIMIT ". variable_get("forum_block_num", "5")), t("New forum topics:")); if ($content) { - $content .= "
". lm(t("more"), array("mod" => "forum")) ."
"; + $content .= "
". lm(t("more"), array("mod" => "forum")) ."
"; } cache_set("forum:block", $content, time() + 60 * 3); -- cgit v1.2.3