From a201a5bba863a6d0dfa3b68d73a227cfcc7f66b6 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 25 Dec 2010 22:18:16 +0000 Subject: updated owner blocks for users and groups git-svn-id: http://code.elgg.org/elgg/trunk@7721 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/start.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'mod/blog/start.php') diff --git a/mod/blog/start.php b/mod/blog/start.php index 8dc3737f8..f3cd31770 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -38,7 +38,7 @@ function blog_init() { register_notification_object('object', 'blog', elgg_echo('blog:newpost')); elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'blog_notify_message'); - elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'blog_user_ownerblock_menu'); + elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'blog_owner_block_menu'); // pingbacks //elgg_register_event_handler('create', 'object', 'blog_incoming_ping'); @@ -223,11 +223,20 @@ function blog_url_handler($entity) { } /** - * Add a menu item to the user ownerblock + * Add a menu item to an ownerblock */ -function blog_user_ownerblock_menu($hook, $type, $return, $params) { - $item = new ElggMenuItem('blog', elgg_echo('blog'), "pg/blog/owner/{$params['user']->username}"); - elgg_register_menu_item('user_ownerblock', $item); +function blog_owner_block_menu($hook, $type, $return, $params) { + if (elgg_instanceof($params['entity'], 'user')) { + $url = "pg/blog/owner/{$params['entity']->username}"; + $item = new ElggMenuItem('blog', elgg_echo('blog'), $url); + elgg_register_menu_item('owner_block', $item); + } else { + if ($params['entity']->blog_enable != "no") { + $url = "pg/blog/group/{$params['entity']->guid}/owner"; + $item = new ElggMenuItem('blog', elgg_echo('blog:group'), $url); + elgg_register_menu_item('owner_block', $item); + } + } } /** -- cgit v1.2.3