aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/users.php32
-rw-r--r--engine/lib/usersettings.php31
2 files changed, 36 insertions, 27 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index d22e42ebf..d69461c2b 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1336,6 +1336,7 @@ function friends_page_handler($page_elements) {
* @return void
*/
function friends_of_page_handler($page_elements) {
+ elgg_set_context('friends');
if (isset($page_elements[0]) && $user = get_user_by_username($page_elements[0])) {
set_page_owner($user->getGUID());
}
@@ -1490,22 +1491,23 @@ function elgg_members_page_handler($page) {
* @return void
*/
function users_pagesetup() {
- // Load config
- global $CONFIG;
-
- //add submenu options
- if (elgg_get_context() == "friends" || elgg_get_context() == "friendsof") {
- // || elgg_get_context() == "collections") { - disabled as we no longer use collections
-
- add_submenu_item(elgg_echo('friends'), $CONFIG->wwwroot . "pg/friends/"
- . elgg_get_page_owner()->username);
- add_submenu_item(elgg_echo('friends:of'), $CONFIG->wwwroot . "pg/friendsof/"
- . elgg_get_page_owner()->username);
-
- if (is_plugin_enabled('members')) {
- add_submenu_item(elgg_echo('members:browse'), $CONFIG->wwwroot . "mod/members/index.php");
- }
+ if (elgg_get_page_owner_guid()) {
+ $params = array(
+ 'name' => 'friends',
+ 'title' => elgg_echo('friends'),
+ 'url' => 'pg/friends/' . elgg_get_page_owner()->username,
+ 'contexts' => array('friends')
+ );
+ elgg_register_menu_item('page', $params);
+
+ $params = array(
+ 'name' => 'friendsof',
+ 'title' => elgg_echo('friends:of'),
+ 'url' => 'pg/friendsof/' . elgg_get_page_owner()->username,
+ 'contexts' => array('friends')
+ );
+ elgg_register_menu_item('page', $params);
}
}
diff --git a/engine/lib/usersettings.php b/engine/lib/usersettings.php
index 7192ea0fa..f6bbaea06 100644
--- a/engine/lib/usersettings.php
+++ b/engine/lib/usersettings.php
@@ -42,20 +42,27 @@ $priority = 500) {
* @return void
*/
function usersettings_pagesetup() {
- // Get config
- global $CONFIG;
-
- // Menu options
- if (elgg_get_context() == "settings") {
+ if (elgg_get_context() == "settings" && get_loggedin_userid()) {
$user = get_loggedin_user();
- add_submenu_item(elgg_echo('usersettings:user:opt:linktext'),
- $CONFIG->wwwroot . "pg/settings/user/{$user->username}/");
-
- add_submenu_item(elgg_echo('usersettings:plugins:opt:linktext'),
- $CONFIG->wwwroot . "pg/settings/plugins/{$user->username}/");
- add_submenu_item(elgg_echo('usersettings:statistics:opt:linktext'),
- $CONFIG->wwwroot . "pg/settings/statistics/{$user->username}/");
+ $params = array(
+ 'name' => '1_account',
+ 'title' => elgg_echo('usersettings:user:opt:linktext'),
+ 'url' => "pg/settings/user/{$user->username}",
+ );
+ elgg_register_menu_item('page', $params);
+ $params = array(
+ 'name' => '1_plugins',
+ 'title' => elgg_echo('usersettings:plugins:opt:linktext'),
+ 'url' => "pg/settings/plugins/{$user->username}",
+ );
+ elgg_register_menu_item('page', $params);
+ $params = array(
+ 'name' => '1_statistics',
+ 'title' => elgg_echo('usersettings:statistics:opt:linktext'),
+ 'url' => "pg/settings/statistics/{$user->username}",
+ );
+ elgg_register_menu_item('page', $params);
}
}