diff options
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/users.php | 16 | ||||
-rw-r--r-- | engine/lib/views.php | 25 |
2 files changed, 24 insertions, 17 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php index 353575307..a87b241a2 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1493,17 +1493,17 @@ function elgg_user_hover_menu($hook, $type, $return, $params) { $url = elgg_add_action_tokens_to_url($url); $item = new ElggMenuItem('addfriend', $text, $url); $item->setSection('action'); - elgg_register_menu_item('user_hover', $item); + $return[] = $item; } else { $url = "pg/profile/$user->username/edit"; $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url); $item->setSection('action'); - elgg_register_menu_item('user_hover', $item); + $return[] = $item; $url = "pg/avatar/edit/$user->username"; $item = new ElggMenuItem('avatar:edit', elgg_echo('avatar:edit'), $url); $item->setSection('action'); - elgg_register_menu_item('user_hover', $item); + $return[] = $item; } } @@ -1532,14 +1532,16 @@ function elgg_user_hover_menu($hook, $type, $return, $params) { $url = elgg_add_action_tokens_to_url($url); $item = new ElggMenuItem($action, elgg_echo($action), $url); $item->setSection('admin'); - elgg_register_menu_item('user_hover', $item); + $return[] = $item; } $url = "pg/profile/$user->username/edit"; $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url); $item->setSection('admin'); - elgg_register_menu_item('user_hover', $item); + $return[] = $item; } + + return $return; } /** @@ -1566,8 +1568,10 @@ function elgg_user_admin_menu($hook, $type, $return, $params) { $url = "action/admin/user/$action?guid={$user->guid}"; $url = elgg_add_action_tokens_to_url($url); $item = new ElggMenuItem($action, elgg_echo($action), $url); - elgg_register_menu_item('user_admin', $item); + $return[] = $item; } + + return $return; } /** diff --git a/engine/lib/views.php b/engine/lib/views.php index 1e309f5bd..b5240b431 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -657,27 +657,30 @@ function elgg_view_layout($layout_name, $vars = array()) { * @since 1.8.0 */ function elgg_view_menu($menu_name, array $vars = array()) { - + global $CONFIG; + $vars['name'] = $menu_name; $sort_by = elgg_get_array_value('sort_by', $vars, 'title'); - // Give plugins a chance to add menu items just before creation. - // This supports context sensitive menus (ex. user hover). - elgg_trigger_plugin_hook('register', "menu:$menu_name", $vars, NULL); + $menu = $CONFIG->menus[$menu_name]; + + // Give plugins a chance to add menu items just before creation. + // This supports context sensitive menus (ex. user_hover). + $menu = elgg_trigger_plugin_hook('register', "menu:$menu_name", $vars, $menu); - $builder = new ElggMenuBuilder($menu_name); + $builder = new ElggMenuBuilder($menu); $vars['menu'] = $builder->getMenu($sort_by); $vars['selected_item'] = $builder->getSelected(); // Let plugins modify the menu - $vars['menu'] = elgg_trigger_plugin_hook('prepare', "menu:$menu_name", $vars, $vars['menu']); + $vars['menu'] = elgg_trigger_plugin_hook('prepare', "menu:$menu_name", $vars, $vars['menu']); - if (elgg_view_exists("navigation/menu/$menu_name")) { - return elgg_view("navigation/menu/$menu_name", $vars); - } else { - return elgg_view("navigation/menu/default", $vars); - } + if (elgg_view_exists("navigation/menu/$menu_name")) { + return elgg_view("navigation/menu/$menu_name", $vars); + } else { + return elgg_view("navigation/menu/default", $vars); + } } /** |