summaryrefslogtreecommitdiff
path: root/modules/blog
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-05-24 04:51:18 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-05-24 04:51:18 +0000
commit4c94e681599bc5fccfdefa99cd54e843a9d68273 (patch)
tree3c8c5cd75fb37d39bff17fab75d964f214c86dfa /modules/blog
parent822647a17608bf6a7e1a17973ec3c55cfc27ed7e (diff)
downloadbrdo-4c94e681599bc5fccfdefa99cd54e843a9d68273.tar.gz
brdo-4c94e681599bc5fccfdefa99cd54e843a9d68273.tar.bz2
#671452 by Rob Loach: Make Blog module add its action link correctly.
Diffstat (limited to 'modules/blog')
-rw-r--r--modules/blog/blog.module15
-rw-r--r--modules/blog/blog.pages.inc15
2 files changed, 16 insertions, 14 deletions
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 5e09d50db..b728e439a 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -137,6 +137,8 @@ function blog_menu() {
* Implements hook_menu_local_tasks_alter().
*/
function blog_menu_local_tasks_alter(&$data, $router_item, $root_path) {
+ global $user;
+
// Add action link to 'node/add/blog' on 'blog' page.
if ($root_path == 'blog') {
$item = menu_get_item('node/add/blog');
@@ -148,6 +150,19 @@ function blog_menu_local_tasks_alter(&$data, $router_item, $root_path) {
);
}
}
+ // Provide a helper action link to the author on the 'blog/%' page.
+ else if ($root_path == 'blog/%' && $router_item['page_arguments'][0]->uid == $user->uid) {
+ $data['actions']['output']['blog'] = array(
+ '#theme' => 'menu_local_action',
+ );
+ if (user_access('create blog content')) {
+ $data['actions']['output']['blog']['#link']['title'] = t('Post new blog entry.');
+ $data['actions']['output']['blog']['#link']['href'] = 'node/add/blog';
+ }
+ else {
+ $data['actions']['output']['blog']['#link']['title'] = t('You are not allowed to post a new blog entry.');
+ }
+ }
}
/**
diff --git a/modules/blog/blog.pages.inc b/modules/blog/blog.pages.inc
index 35556008e..587fbbf29 100644
--- a/modules/blog/blog.pages.inc
+++ b/modules/blog/blog.pages.inc
@@ -14,20 +14,7 @@ function blog_page_user($account) {
drupal_set_title($title = t("@name's blog", array('@name' => format_username($account))), PASS_THROUGH);
- $items = array();
-
- if (($account->uid == $user->uid) && user_access('create blog content')) {
- $items[] = l(t('Post new blog entry.'), "node/add/blog");
- }
- elseif ($account->uid == $user->uid) {
- $items[] = t('You are not allowed to post a new blog entry.');
- }
-
- $build['blog_actions'] = array(
- '#items' => $items,
- '#theme' => 'item_list',
- '#weight' => -1,
- );
+ $build = array();
$query = db_select('node', 'n')->extend('PagerDefault');
$nids = $query