aboutsummaryrefslogtreecommitdiff
path: root/mod/pages
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-25 22:18:16 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-25 22:18:16 +0000
commita201a5bba863a6d0dfa3b68d73a227cfcc7f66b6 (patch)
treeaf382c4f81d43b63c4afe60ace1824c298390d47 /mod/pages
parent58bd19d7cf35e6159124716d0da48d91354d3a2f (diff)
downloadelgg-a201a5bba863a6d0dfa3b68d73a227cfcc7f66b6.tar.gz
elgg-a201a5bba863a6d0dfa3b68d73a227cfcc7f66b6.tar.bz2
updated owner blocks for users and groups
git-svn-id: http://code.elgg.org/elgg/trunk@7721 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/pages')
-rw-r--r--mod/pages/start.php36
1 files changed, 13 insertions, 23 deletions
diff --git a/mod/pages/start.php b/mod/pages/start.php
index 83c765ccd..ebf102be0 100644
--- a/mod/pages/start.php
+++ b/mod/pages/start.php
@@ -64,7 +64,7 @@ function pages_init() {
'write_access_id' => 'access',
);
- elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'pages_user_ownerblock_menu');
+ elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'pages_owner_block_menu');
// register ecml views to parse
elgg_register_plugin_hook_handler('get_views', 'ecml', 'pages_ecml_views_hook');
@@ -77,29 +77,20 @@ function pages_url($entity) {
}
/**
- * Sets up submenus for the pages system. Triggered on pagesetup.
- *
- */
-function pages_submenus() {
-
- global $CONFIG;
-
- $page_owner = elgg_get_page_owner();
-
- // Group submenu option
- if ($page_owner instanceof ElggGroup && elgg_get_context() == 'groups') {
- if($page_owner->pages_enable != "no"){
- add_submenu_item(elgg_echo("pages:group", array($page_owner->name)), "pg/pages/owned/" . $page_owner->username);
- }
- }
-}
-
-/**
* Add a menu item to the user ownerblock
*/
-function pages_user_ownerblock_menu($hook, $type, $return, $params) {
- $item = new ElggMenuItem('pages', elgg_echo('pages'), "pg/pages/owner/{$params['user']->username}");
- elgg_register_menu_item('user_ownerblock', $item);
+function pages_owner_block_menu($hook, $type, $return, $params) {
+ if (elgg_instanceof($params['entity'], 'user')) {
+ $url = "pg/pages/owner/{$params['entity']->username}";
+ $item = new ElggMenuItem('pages', elgg_echo('pages'), $url);
+ elgg_register_menu_item('owner_block', $item);
+ } else {
+ if ($params['entity']->pages_enable != "no") {
+ $url = "pg/pages/owned/group:{$vars['entity']->guid}";
+ $item = new ElggMenuItem('pages', elgg_echo('pages:group'), $url);
+ elgg_register_menu_item('owner_block', $item);
+ }
+ }
}
/**
@@ -361,4 +352,3 @@ elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'page
// Make sure the pages initialisation function is called on initialisation
elgg_register_event_handler('init','system','pages_init');
-elgg_register_event_handler('pagesetup','system','pages_submenus'); \ No newline at end of file