aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/blog/start.php21
-rw-r--r--mod/bookmarks/start.php21
-rw-r--r--mod/file/start.php7
-rw-r--r--views/default/page_elements/owner_block.php14
4 files changed, 41 insertions, 22 deletions
diff --git a/mod/blog/start.php b/mod/blog/start.php
index 20f51937f..9829f708c 100644
--- a/mod/blog/start.php
+++ b/mod/blog/start.php
@@ -61,6 +61,9 @@ function blog_init() {
// ecml
register_plugin_hook('get_views', 'ecml', 'blog_ecml_views_hook');
+
+ // Register profile menu hook
+ register_plugin_hook('profile_menu', 'profile', 'blog_profile_menu');
}
/**
@@ -193,13 +196,6 @@ function blog_page_setup() {
add_submenu_item(elgg_echo('blog:groups:group_blogs'), $url);
}
}
-
- if ($page_owner instanceof ElggEntity) {
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('blog'),
- 'href' => "{$CONFIG->url}pg/blog/{$page_owner->username}/read",
- ));
- }
}
/**
@@ -216,4 +212,15 @@ function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) {
return $return_value;
}
+function blog_profile_menu($hook, $entity_type, $return_value, $params) {
+ global $CONFIG;
+
+ $return_value[] = array(
+ 'text' => elgg_echo('blog'),
+ 'href' => "{$CONFIG->url}pg/blog/{$params['owner']->username}/read",
+ );
+
+ return $return_value;
+}
+
register_elgg_event_handler('init', 'system', 'blog_init');
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');
diff --git a/mod/file/start.php b/mod/file/start.php
index a257a90ac..b8a26fab5 100644
--- a/mod/file/start.php
+++ b/mod/file/start.php
@@ -79,13 +79,6 @@
add_submenu_item(sprintf(elgg_echo("file:group"),$page_owner->name), $CONFIG->wwwroot . "pg/file/" . $page_owner->username);
}
}
-
- if ($page_owner instanceof ElggEntity) {
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('file'),
- 'href' => "{$CONFIG->url}pg/file/{$page_owner->username}",
- ));
- }
}
/**
diff --git a/views/default/page_elements/owner_block.php b/views/default/page_elements/owner_block.php
index 311d27767..7ddc7e55a 100644
--- a/views/default/page_elements/owner_block.php
+++ b/views/default/page_elements/owner_block.php
@@ -45,7 +45,19 @@ if(is_plugin_enabled('profile')) {
$location = elgg_view('output/tags', array('value' => $owner->location));
$display .= "<p class=\"profile_info location\">$location</p>";
-
+
+ // Trigger owner block menu
+ $params = array('owner' => $owner);
+ $links = trigger_plugin_hook('profile_menu', 'profile', $params, array());
+ if (is_array($links) && !empty($links)) {
+ $display .= '<div><ul>';
+ foreach ($links as $link) {
+ $display .= "<li><a href=\"{$link['href']}\">{$link['text']}</a></li>";
+ }
+ $display .= '</ul></div>';
+ }
+
+ // Allow plugins to extend the owner block contents
$display .= elgg_view('owner_block/profile_extend');
// close owner_block_content