Browse files

Fixes #4731. Configuration and edit profile are the same menu now. Co…

…mmon context is "settings".
  • Loading branch information...
1 parent 8938e2a commit 092cfbcfc0b7bfe82ab369ea39a6afc331d99431 @sembrestels sembrestels committed Jul 19, 2012
Showing with 37 additions and 27 deletions.
  1. +26 −22 engine/lib/user_settings.php
  2. +4 −2 engine/lib/users.php
  3. +3 −1 mod/notifications/start.php
  4. +2 −1 pages/avatar/edit.php
  5. +2 −1 pages/profile/edit.php
View
48 engine/lib/user_settings.php
@@ -265,28 +265,32 @@ function elgg_set_user_default_access() {
* @access private
*/
function usersettings_pagesetup() {
- if (elgg_get_context() == "settings") {
- $user = elgg_get_page_owner_entity();
-
- $params = array(
- 'name' => '1_account',
- 'text' => elgg_echo('usersettings:user:opt:linktext'),
- 'href' => "settings/user/{$user->username}",
- );
- elgg_register_menu_item('page', $params);
- $params = array(
- 'name' => '1_plugins',
- 'text' => elgg_echo('usersettings:plugins:opt:linktext'),
- 'href' => "settings/plugins/{$user->username}",
- );
- elgg_register_menu_item('page', $params);
- $params = array(
- 'name' => '1_statistics',
- 'text' => elgg_echo('usersettings:statistics:opt:linktext'),
- 'href' => "settings/statistics/{$user->username}",
- );
- elgg_register_menu_item('page', $params);
- }
+ $user = elgg_get_page_owner_entity();
+
+ $params = array(
+ 'name' => '1_account',
+ 'text' => elgg_echo('usersettings:user:opt:linktext'),
+ 'href' => "settings/user/{$user->username}",
+ 'section' => 'configure',
+ 'contexts' => array('settings'),
+ );
+ elgg_register_menu_item('page', $params);
+ $params = array(
+ 'name' => '1_plugins',
+ 'text' => elgg_echo('usersettings:plugins:opt:linktext'),
+ 'href' => "settings/plugins/{$user->username}",
+ 'section' => 'configure',
+ 'contexts' => array('settings'),
+ );
+ elgg_register_menu_item('page', $params);
+ $params = array(
+ 'name' => '1_statistics',
+ 'text' => elgg_echo('usersettings:statistics:opt:linktext'),
+ 'href' => "settings/statistics/{$user->username}",
+ 'section' => 'configure',
+ 'contexts' => array('settings'),
+ );
+ elgg_register_menu_item('page', $params);
}
/**
View
6 engine/lib/users.php
@@ -1482,14 +1482,16 @@ function users_pagesetup() {
'name' => 'edit_avatar',
'href' => "avatar/edit/{$owner->username}",
'text' => elgg_echo('avatar:edit'),
- 'contexts' => array('profile_edit'),
+ 'section' => '1_profile',
+ 'contexts' => array('settings'),
));
elgg_register_menu_item('page', array(
'name' => 'edit_profile',
'href' => "profile/{$owner->username}/edit",
'text' => elgg_echo('profile:edit'),
- 'contexts' => array('profile_edit'),
+ 'section' => '1_profile',
+ 'contexts' => array('settings'),
));
}
View
4 mod/notifications/start.php
@@ -77,7 +77,7 @@ function notifications_page_handler($page) {
*
*/
function notifications_plugin_pagesetup() {
- if (elgg_get_context() == "settings" && elgg_get_logged_in_user_guid()) {
+ if (elgg_in_context("settings") && elgg_get_logged_in_user_guid()) {
$user = elgg_get_page_owner_entity();
if (!$user) {
@@ -88,6 +88,7 @@ function notifications_plugin_pagesetup() {
'name' => '2_a_user_notify',
'text' => elgg_echo('notifications:subscriptions:changesettings'),
'href' => "notifications/personal/{$user->username}",
+ 'section' => "notifications",
);
elgg_register_menu_item('page', $params);
@@ -96,6 +97,7 @@ function notifications_plugin_pagesetup() {
'name' => '2_group_notify',
'text' => elgg_echo('notifications:subscriptions:changesettings:groups'),
'href' => "notifications/group/{$user->username}",
+ 'section' => "notifications",
);
elgg_register_menu_item('page', $params);
}
View
3 pages/avatar/edit.php
@@ -6,7 +6,8 @@
// Only logged in users
gatekeeper();
-elgg_set_context('profile_edit');
+elgg_push_context('settings');
+elgg_push_context('profile_edit');
@sembrestels
Elgg member

I thought it better. I think we should deprecate profile_edit context in benefit of settings context. If we want only one menu for settings and profile, we should have only one context. If not, there will appear items in some pages but in some pages not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
$title = elgg_echo('avatar:edit');
View
3 pages/profile/edit.php
@@ -17,7 +17,8 @@
forward();
}
-elgg_set_context('profile_edit');
+elgg_push_context('settings');
+elgg_push_context('profile_edit');
$title = elgg_echo('profile:edit');

0 comments on commit 092cfbc

Please sign in to comment.