From aa75f0a18c06950d39778fab310086257c4909d6 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 2 Jul 2005 11:58:16 +0000 Subject: - Patch 7897: don't show blocks if they have no content --- modules/statistics/statistics.module | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'modules/statistics/statistics.module') diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 88e1e0daa..f29d9f1f4 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -447,25 +447,25 @@ function statistics_block($op = 'list', $delta = 0, $edit = array()) { $content = array(); $daytop = variable_get('statistics_block_top_day_num', 0); - if ($daytop) { - $content[] = node_title_list(statistics_title_list('daycount', $daytop), t("Today's:")); + if ($daytop && ($result = statistics_title_list('daycount', $daytop)) && db_num_rows($result)) { + $content[] = node_title_list($result, t("Today's:")); } $alltimetop = variable_get('statistics_block_top_all_num', 0); - if ($alltimetop) { - $content[] = node_title_list(statistics_title_list('totalcount', $alltimetop), t('All time:')); + if ($alltimetop && ($result = statistics_title_list('totalcount', $alltimetop)) && db_num_rows($result)) { + $content[] = node_title_list($result, t('All time:')); } $lasttop = variable_get('statistics_block_top_last_num', 0); - if ($lasttop) { - $content[] = node_title_list(statistics_title_list('timestamp', $lasttop), t('Last viewed:')); + if ($lasttop && ($result = statistics_title_list('timestamp', $lasttop)) && db_num_rows($result)) { + $content[] = node_title_list($result, t('Last viewed:')); } - $output = implode($content, '
'); - $block['subject'] = t('Popular content'); - $block['content'] = $output; - - return $block; + if (count($content)) { + $block['content'] = implode($content, '
'); + $block['subject'] = t('Popular content'); + return $block; + } } } } -- cgit v1.2.3