aboutsummaryrefslogtreecommitdiff
path: root/mod/profile/start.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-14 11:17:13 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-14 11:17:13 +0000
commit8a636a3aa83809e3db3ca327aa77e806fb7a6ed3 (patch)
tree049358471b2ae27bbc3f73562fc9456e5f090ca8 /mod/profile/start.php
parent71951a0c879937848d47328f305f0ab0724ea243 (diff)
downloadelgg-8a636a3aa83809e3db3ca327aa77e806fb7a6ed3.tar.gz
elgg-8a636a3aa83809e3db3ca327aa77e806fb7a6ed3.tar.bz2
Closes #235: Simple profile editor in place
git-svn-id: https://code.elgg.org/elgg/trunk@2255 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/profile/start.php')
-rw-r--r--mod/profile/start.php45
1 files changed, 42 insertions, 3 deletions
diff --git a/mod/profile/start.php b/mod/profile/start.php
index 4d7d59acf..89e70b5ce 100644
--- a/mod/profile/start.php
+++ b/mod/profile/start.php
@@ -48,7 +48,8 @@
);*/
// Register a page handler, so we can have nice URLs
- register_page_handler('profile','profile_page_handler');
+ register_page_handler('profile','profile_page_handler');
+ register_page_handler('defaultprofile','profileedit_page_handler');
register_page_handler('icon','profile_icon_handler');
register_page_handler('iconjs','profile_iconjs_handler');
@@ -113,7 +114,9 @@
if (!$type) $type = 'text';
// Set array
- $loaded_defaults["profile:admin_defined_profile_$n"] = $type;
+ $loaded_defaults["admin_defined_profile_$n"] = $type;
+
+ $n++;
}
if (count($loaded_defaults))
$profile_defaults = $loaded_defaults;
@@ -137,6 +140,38 @@
// Include the standard profile index
include($CONFIG->pluginspath . "profile/index.php");
+ }
+
+ /**
+ * Profile edit page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+ function profileedit_page_handler($page) {
+
+ global $CONFIG;
+
+ // The username should be the file we're getting
+ if (isset($page[0])) {
+ switch ($page[0])
+ {
+ case 'edit' :
+ default: include($CONFIG->pluginspath . "profile/defaultprofile.php");
+ }
+ }
+
+ }
+
+ /**
+ * Pagesetup function
+ *
+ */
+ function profile_pagesetup()
+ {
+ if (get_context() == 'admin' && isadminloggedin()) {
+ global $CONFIG;
+ add_submenu_item(elgg_echo('profile:edit:default'), $CONFIG->wwwroot . 'pg/defaultprofile/edit/');
+ }
}
/**
@@ -227,6 +262,8 @@
// Make sure the profile initialisation function is called on initialisation
register_elgg_event_handler('init','system','profile_init',1);
register_elgg_event_handler('init','system','profile_fields_setup', 10000); // Ensure this runs after other plugins
+
+ register_elgg_event_handler('pagesetup','system','profile_pagesetup');
// Register actions
@@ -234,7 +271,9 @@
register_action("profile/edit",false,$CONFIG->pluginspath . "profile/actions/edit.php");
register_action("profile/iconupload",false,$CONFIG->pluginspath . "profile/actions/iconupload.php");
register_action("profile/cropicon",false,$CONFIG->pluginspath . "profile/actions/cropicon.php");
-
+ register_action("profile/editdefault",false,$CONFIG->pluginspath . "profile/actions/editdefault.php", true);
+ register_action("profile/editdefault/delete",false,$CONFIG->pluginspath . "profile/actions/deletedefaultprofileitem.php", true);
+ register_action("profile/editdefault/reset",false,$CONFIG->pluginspath . "profile/actions/resetdefaultprofile.php", true);
// Define widgets for use in this context