diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-07-02 11:58:16 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-07-02 11:58:16 +0000 |
commit | aa75f0a18c06950d39778fab310086257c4909d6 (patch) | |
tree | b4f02a692d1c86cb8aa92a167e043942a50a80ca /modules/statistics/statistics.module | |
parent | d9d21371df9436127e9bf75576fff199674ede41 (diff) | |
download | brdo-aa75f0a18c06950d39778fab310086257c4909d6.tar.gz brdo-aa75f0a18c06950d39778fab310086257c4909d6.tar.bz2 |
- Patch 7897: don't show blocks if they have no content
Diffstat (limited to 'modules/statistics/statistics.module')
-rw-r--r-- | modules/statistics/statistics.module | 22 |
1 files changed, 11 insertions, 11 deletions
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, '<br />'); - $block['subject'] = t('Popular content'); - $block['content'] = $output; - - return $block; + if (count($content)) { + $block['content'] = implode($content, '<br />'); + $block['subject'] = t('Popular content'); + return $block; + } } } } |