aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-18 17:47:50 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-18 17:47:50 +0000
commit569f19d8ff89539eb8d38b1ca1b07a2baa41852c (patch)
tree0ace0c2792db822cd0db5eae672f1f472a29439a /engine
parent8ec093ecc1bf28c09f5d2dbe3c7bc8e6a2485ac6 (diff)
downloadelgg-569f19d8ff89539eb8d38b1ca1b07a2baa41852c.tar.gz
elgg-569f19d8ff89539eb8d38b1ca1b07a2baa41852c.tar.bz2
half way through converting submenu to new menu code - pages and groups are the two major users left
git-svn-id: http://code.elgg.org/elgg/trunk@7669 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/classes/ElggMenuItem.php3
-rw-r--r--engine/lib/users.php32
-rw-r--r--engine/lib/usersettings.php31
3 files changed, 39 insertions, 27 deletions
diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php
index af7bbc9c2..f2eb1534f 100644
--- a/engine/classes/ElggMenuItem.php
+++ b/engine/classes/ElggMenuItem.php
@@ -87,6 +87,9 @@ class ElggMenuItem {
}
$item = new ElggMenuItem($options['name'], $options['title'], $options['url']);
+ unset($options['name']);
+ unset($options['title']);
+ unset($options['url']);
// special catch in case someone uses context rather than contexts
if (isset($options['context'])) {
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);
}
}