diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-02-10 18:58:28 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-02-10 18:58:28 +0000 |
commit | 44eb6d6992a27db37d980feea129917f5751ace9 (patch) | |
tree | 50237a0044fdbc7461c64ea4ef99a9b53327a588 /modules | |
parent | 29d78cbe1d1c612fd4f8128ce799126fa4b7f04a (diff) | |
download | brdo-44eb6d6992a27db37d980feea129917f5751ace9.tar.gz brdo-44eb6d6992a27db37d980feea129917f5751ace9.tar.bz2 |
- Patch #139290 by Arancaytar, Rob Loach, GreenLED, matt et al: when a user has no blog posts, show a status message.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/blog/blog.pages.inc | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/modules/blog/blog.pages.inc b/modules/blog/blog.pages.inc index a0b54967d..8548ede62 100644 --- a/modules/blog/blog.pages.inc +++ b/modules/blog/blog.pages.inc @@ -26,10 +26,24 @@ function blog_page_user($account) { $output = theme('item_list', $items); $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid); + $has_posts = FALSE; + while ($node = db_fetch_object($result)) { $output .= node_view(node_load($node->nid), 1); + $has_posts = TRUE; + } + + if ($has_posts) { + $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); + } + else { + if ($account->uid == $user->uid) { + drupal_set_message(t('You have not created any blog entries.')); + } + else { + drupal_set_message(t('!author has not created any blog entries.', array('!author' => theme('username', $account)))); + } } - $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); drupal_add_feed(url('blog/'. $account->uid .'/feed'), t('RSS - !title', array('!title' => $title))); return $output; @@ -42,13 +56,28 @@ function blog_page_last() { global $user; $output = ''; + $items = array(); + + if (user_access('edit own blog')) { + $items[] = l(t('Create new blog entry.'), "node/add/blog"); + } + + $output = theme('item_list', $items); $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10)); + $has_posts = FALSE; while ($node = db_fetch_object($result)) { $output .= node_view(node_load($node->nid), 1); + $has_posts = TRUE; + } + + if ($has_posts) { + $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); + } + else { + drupal_set_message(t('No blog entries have been created.')); } - $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); drupal_add_feed(url('blog/feed'), t('RSS - blogs')); return $output; |