aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/usersettings.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-17 15:46:16 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-17 15:46:16 +0000
commit7184453089f95216643ab697930b020890c65006 (patch)
tree27a64f6181a3a505e7822e0671617125a104ba02 /engine/lib/usersettings.php
parentab1a4a3daa441fcd2e4d9b37267de3b48fae9d6f (diff)
downloadelgg-7184453089f95216643ab697930b020890c65006.tar.gz
elgg-7184453089f95216643ab697930b020890c65006.tar.bz2
Closes #335: Marcus Povey :
* Per user tools settings now present again (only displays if there are settings present AND the plugin is enabled - needs skinning accordingly) * Re-jigged the settings code to behave like a proper page handler. * Minor tweak to language git-svn-id: https://code.elgg.org/elgg/trunk@2279 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/usersettings.php')
-rw-r--r--engine/lib/usersettings.php33
1 files changed, 29 insertions, 4 deletions
diff --git a/engine/lib/usersettings.php b/engine/lib/usersettings.php
index 647cbdaed..6f10ebdbd 100644
--- a/engine/lib/usersettings.php
+++ b/engine/lib/usersettings.php
@@ -40,10 +40,33 @@
// Menu options
if (get_context() == "settings") {
- add_submenu_item(elgg_echo('usersettings:user:opt:linktext'),$CONFIG->wwwroot . "pg/settings/user?username=" . $_SESSION['user']->username);
- add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . 'mod/profile/editicon.php');
- add_submenu_item(elgg_echo('usersettings:statistics:opt:linktext'),$CONFIG->wwwroot . "pg/settings/statistics?username=" . $_SESSION['user']->username);
+ add_submenu_item(elgg_echo('usersettings:user:opt:linktext'),$CONFIG->wwwroot . "pg/settings/user/{$_SESSION['user']->username}/");
+ add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . 'mod/profile/editicon.php');
+ add_submenu_item(elgg_echo('usersettings:plugins:opt:linktext'),$CONFIG->wwwroot . "pg/settings/plugins/{$_SESSION['user']->username}/");
+ add_submenu_item(elgg_echo('usersettings:statistics:opt:linktext'),$CONFIG->wwwroot . "pg/settings/statistics/{$_SESSION['user']->username}/");
}
+ }
+
+ function usersettings_page_handler($page)
+ {
+ global $CONFIG;
+
+ $path = $CONFIG->path . "settings/index.php";
+
+ if ($page[0])
+ {
+ switch ($page[0])
+ {
+ case 'user' : $path = $CONFIG->path . "settings/user.php"; break;
+ case 'statistics' : $path = $CONFIG->path . "settings/statistics.php"; break;
+ case 'plugins' : $path = $CONFIG->path . "settings/plugins.php"; break;
+ }
+ }
+
+ if ($page[1])
+ set_input('username', $page[1]);
+
+ include($path);
}
/**
@@ -51,10 +74,12 @@
*/
function usersettings_init()
{
-
+ // Page handler
+ register_page_handler('settings','usersettings_page_handler');
}
/// Register init function
+ register_elgg_event_handler('init','system','usersettings_init');
register_elgg_event_handler('pagesetup','system','usersettings_pagesetup');
?> \ No newline at end of file