From 33d589650db886fa580aa5bd47672a71bb4fc4c0 Mon Sep 17 00:00:00 2001 From: nickw Date: Fri, 21 May 2010 21:53:49 +0000 Subject: Registering new plugin hooks to extend the owner block profile menu. git-svn-id: http://code.elgg.org/elgg/trunk@6130 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/bookmarks/start.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'mod/bookmarks/start.php') diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 205069197..ef8a4e011 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -45,6 +45,9 @@ function bookmarks_init() { // Extend Groups profile page elgg_extend_view('groups/tool_latest','bookmarks/group_bookmarks'); + + // Register profile menu hook + register_plugin_hook('profile_menu', 'profile', 'bookmarks_profile_menu'); } /** @@ -63,13 +66,6 @@ function bookmarks_pagesetup() { add_submenu_item(sprintf(elgg_echo("bookmarks:group"),$page_owner->name), $CONFIG->wwwroot . "pg/bookmarks/" . $page_owner->username . '/items'); } } - - if ($page_owner instanceof ElggEntity) { - elgg_add_submenu_item(array( - 'text' => elgg_echo('bookmarks'), - 'href' => "{$CONFIG->url}pg/bookmarks/{$page_owner->username}", - )); - } } } @@ -301,6 +297,17 @@ function create_wire_url_code(){ return $code; } +function bookmarks_profile_menu($hook, $entity_type, $return_value, $params) { + global $CONFIG; + + $return_value[] = array( + 'text' => elgg_echo('bookmarks'), + 'href' => "{$CONFIG->url}pg/bookmarks/{$params['owner']->username}", + ); + + return $return_value; +} + // Make sure the initialisation function is called on initialisation register_elgg_event_handler('init','system','bookmarks_init'); register_elgg_event_handler('pagesetup','system','bookmarks_pagesetup'); -- cgit v1.2.3