summaryrefslogtreecommitdiff
path: root/modules/blog/blog.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-07-02 11:58:16 +0000
committerDries Buytaert <dries@buytaert.net>2005-07-02 11:58:16 +0000
commitaa75f0a18c06950d39778fab310086257c4909d6 (patch)
treeb4f02a692d1c86cb8aa92a167e043942a50a80ca /modules/blog/blog.module
parentd9d21371df9436127e9bf75576fff199674ede41 (diff)
downloadbrdo-aa75f0a18c06950d39778fab310086257c4909d6.tar.gz
brdo-aa75f0a18c06950d39778fab310086257c4909d6.tar.bz2
- Patch 7897: don't show blocks if they have no content
Diffstat (limited to 'modules/blog/blog.module')
-rw-r--r--modules/blog/blog.module11
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 31d4689b5..26c2c43aa 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -277,11 +277,14 @@ function blog_block($op = 'list', $delta = 0) {
}
else if ($op == 'view') {
if (user_access('access content')) {
- $block['content'] = node_title_list(db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10));
- $block['content'] .= '<div class="more-link">'. l(t('more'), 'blog', array('title' => t('Read the latest blog entries.'))) .'</div>';
- $block['subject'] = t('Recent blog posts');
+ $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10);
+ if (db_num_rows($result)) {
+ $block['content'] = node_title_list($result);
+ $block['content'] .= '<div class="more-link">'. l(t('more'), 'blog', array('title' => t('Read the latest blog entries.'))) .'</div>';
+ $block['subject'] = t('Recent blog posts');
+ return $block;
+ }
}
- return $block;
}
}