From 3850904d467fe0ca6cb8800a75f1b9e233bf8d90 Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 6 Jul 2009 11:03:28 +0000 Subject: * Closes #1104: Edit profile and edit icon links on pulldown menu for editable users. * Closes #545: Admins are now able to edit profiles and icons of other users. * CSRF protection added to icon upload and edit code. * Version bump. git-svn-id: https://code.elgg.org/elgg/trunk@3387 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/start.php | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'mod/profile/start.php') diff --git a/mod/profile/start.php b/mod/profile/start.php index 3dd57c450..2b4d08c5d 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -67,11 +67,7 @@ if (get_context() == "profile") extend_view('canvas_header/submenu','profile/submenu'); - //add submenu options - if (get_context() == "profile") { - add_submenu_item(elgg_echo('profile:editdetails'), $CONFIG->wwwroot . "mod/profile/edit.php"); - add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . "mod/profile/editicon.php"); - } + // Extend context menu with admin links if (isadminloggedin()) @@ -146,7 +142,18 @@ // The username should be the file we're getting if (isset($page[0])) { set_input('username',$page[0]); - } + } + // Any sub pages? + if (isset($page[1])) { + + switch ($page[1]) + { + case 'edit' : include($CONFIG->pluginspath . "profile/edit.php"); break; + case 'editicon' : include($CONFIG->pluginspath . "profile/editicon.php"); break; + + } + } + // Include the standard profile index include($CONFIG->pluginspath . "profile/index.php"); @@ -165,7 +172,6 @@ if (isset($page[0])) { switch ($page[0]) { - case 'edit' : default: include($CONFIG->pluginspath . "profile/defaultprofile.php"); } } @@ -178,10 +184,19 @@ */ function profile_pagesetup() { + global $CONFIG; if (get_context() == 'admin' && isadminloggedin()) { - global $CONFIG; + add_submenu_item(elgg_echo('profile:edit:default'), $CONFIG->wwwroot . 'pg/defaultprofile/edit/'); } + + //add submenu options + if (get_context() == "profile") { + $page_owner = page_owner_entity(); + + add_submenu_item(elgg_echo('profile:editdetails'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/edit/"); + add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/editicon/"); + } } /** -- cgit v1.2.3