summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-02-10 19:14:50 +0000
committerDries Buytaert <dries@buytaert.net>2005-02-10 19:14:50 +0000
commitf228b1cb9c1c4bd171a448ba8eccf353a91c2f83 (patch)
tree01eb170829b396bb6782a0319a8cf1ca1ff5b6f3
parenta5b8a0a8fbc993d7419027e53613e1dc8e17f01d (diff)
downloadbrdo-f228b1cb9c1c4bd171a448ba8eccf353a91c2f83.tar.gz
brdo-f228b1cb9c1c4bd171a448ba8eccf353a91c2f83.tar.bz2
- Patch #16829 by kbahey: separated the forum block for sake of consistency with other blocks.
-rw-r--r--modules/forum.module27
-rw-r--r--modules/forum/forum.module27
2 files changed, 36 insertions, 18 deletions
diff --git a/modules/forum.module b/modules/forum.module
index 6f1292c23..9066786de 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -301,7 +301,8 @@ function forum_load($node) {
function forum_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
- $blocks[0]['info'] = t('Forum topics');
+ $blocks[0]['info'] = t('Active forum topics');
+ $blocks[1]['info'] = t('New forum topics');
return $blocks;
case 'configure':
@@ -314,19 +315,27 @@ function forum_block($op = 'list', $delta = 0, $edit = array()) {
case 'view':
if (user_access('access content')) {
- $sql = "SELECT n.nid, n.title, l.last_comment_timestamp, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND n.type='forum' ORDER BY l.last_comment_timestamp DESC";
- $sql = db_rewrite_sql($sql);
- $content = node_title_list(db_query_range($sql, 0, variable_get('forum_block_num', '5')), t('Active forum topics:'));
-
- $sql = "SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.type = 'forum' AND n.status = 1 ORDER BY n.nid DESC";
- $sql = db_rewrite_sql($sql);
- $content .= node_title_list(db_query_range($sql, 0, variable_get('forum_block_num', '5')), t('New forum topics:'));
+ switch ($delta) {
+ case 0:
+ $title = t('Active forum topics');
+ $sql = "SELECT n.nid, n.title, l.last_comment_timestamp, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND n.type='forum' ORDER BY l.last_comment_timestamp DESC";
+ $sql = db_rewrite_sql($sql);
+ $content = node_title_list(db_query_range($sql, 0, variable_get('forum_block_num', '5')));
+ break;
+
+ case 1:
+ $title = t('New forum topics');
+ $sql = "SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.type = 'forum' AND n.status = 1 ORDER BY n.nid DESC";
+ $sql = db_rewrite_sql($sql);
+ $content .= node_title_list(db_query_range($sql, 0, variable_get('forum_block_num', '5')));
+ break;
+ }
if ($content) {
$content .= '<div class="more-link">'. l(t('more'), 'forum', array('title' => t('Read the latest forum topics.'))) .'</div>';
}
- $block['subject'] = t('Forum topics');
+ $block['subject'] = $title;
$block['content'] = $content;
return $block;
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 6f1292c23..9066786de 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -301,7 +301,8 @@ function forum_load($node) {
function forum_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
- $blocks[0]['info'] = t('Forum topics');
+ $blocks[0]['info'] = t('Active forum topics');
+ $blocks[1]['info'] = t('New forum topics');
return $blocks;
case 'configure':
@@ -314,19 +315,27 @@ function forum_block($op = 'list', $delta = 0, $edit = array()) {
case 'view':
if (user_access('access content')) {
- $sql = "SELECT n.nid, n.title, l.last_comment_timestamp, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND n.type='forum' ORDER BY l.last_comment_timestamp DESC";
- $sql = db_rewrite_sql($sql);
- $content = node_title_list(db_query_range($sql, 0, variable_get('forum_block_num', '5')), t('Active forum topics:'));
-
- $sql = "SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.type = 'forum' AND n.status = 1 ORDER BY n.nid DESC";
- $sql = db_rewrite_sql($sql);
- $content .= node_title_list(db_query_range($sql, 0, variable_get('forum_block_num', '5')), t('New forum topics:'));
+ switch ($delta) {
+ case 0:
+ $title = t('Active forum topics');
+ $sql = "SELECT n.nid, n.title, l.last_comment_timestamp, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND n.type='forum' ORDER BY l.last_comment_timestamp DESC";
+ $sql = db_rewrite_sql($sql);
+ $content = node_title_list(db_query_range($sql, 0, variable_get('forum_block_num', '5')));
+ break;
+
+ case 1:
+ $title = t('New forum topics');
+ $sql = "SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.type = 'forum' AND n.status = 1 ORDER BY n.nid DESC";
+ $sql = db_rewrite_sql($sql);
+ $content .= node_title_list(db_query_range($sql, 0, variable_get('forum_block_num', '5')));
+ break;
+ }
if ($content) {
$content .= '<div class="more-link">'. l(t('more'), 'forum', array('title' => t('Read the latest forum topics.'))) .'</div>';
}
- $block['subject'] = t('Forum topics');
+ $block['subject'] = $title;
$block['content'] = $content;
return $block;