diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-05-25 03:59:38 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-05-25 03:59:38 +0000 |
commit | 0ff0af160166a87147eeaf248e60419f84c485cb (patch) | |
tree | adc18514f254798b20aff3e6e586fb92eea8fe7f /modules | |
parent | 09354344e078cbc2b64a4f7ba97a2871db18ec41 (diff) | |
download | brdo-0ff0af160166a87147eeaf248e60419f84c485cb.tar.gz brdo-0ff0af160166a87147eeaf248e60419f84c485cb.tar.bz2 |
- #23014: Only show forum blocks if there are topics to list.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/forum.module | 10 | ||||
-rw-r--r-- | modules/forum/forum.module | 10 |
2 files changed, 16 insertions, 4 deletions
diff --git a/modules/forum.module b/modules/forum.module index 9b75862c7..0b4b6cb2d 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -352,13 +352,19 @@ function forum_block($op = 'list', $delta = 0, $edit = array()) { case 0: $title = t('Active forum topics'); $sql = db_rewrite_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"); - $content = node_title_list(db_query_range($sql, 0, variable_get('forum_block_num_0', '5'))); + $result = db_query_range($sql, 0, variable_get('forum_block_num_0', '5')); + if (db_num_rows($result)) { + $content = node_title_list($result); + } break; case 1: $title = t('New forum topics'); $sql = db_rewrite_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"); - $content = node_title_list(db_query_range($sql, 0, variable_get('forum_block_num_1', '5'))); + $result = db_query_range($sql, 0, variable_get('forum_block_num_1', '5')); + if (db_num_rows($result)) { + $content = node_title_list($result); + } break; } diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 9b75862c7..0b4b6cb2d 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -352,13 +352,19 @@ function forum_block($op = 'list', $delta = 0, $edit = array()) { case 0: $title = t('Active forum topics'); $sql = db_rewrite_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"); - $content = node_title_list(db_query_range($sql, 0, variable_get('forum_block_num_0', '5'))); + $result = db_query_range($sql, 0, variable_get('forum_block_num_0', '5')); + if (db_num_rows($result)) { + $content = node_title_list($result); + } break; case 1: $title = t('New forum topics'); $sql = db_rewrite_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"); - $content = node_title_list(db_query_range($sql, 0, variable_get('forum_block_num_1', '5'))); + $result = db_query_range($sql, 0, variable_get('forum_block_num_1', '5')); + if (db_num_rows($result)) { + $content = node_title_list($result); + } break; } |