diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-13 09:35:29 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-13 09:35:29 +0000 |
commit | f7fa53526b70e20ac09ccdda701ee2ede1887273 (patch) | |
tree | 672e313adc73506c54b53708a1513cb5cb1d4121 | |
parent | b6151a5e60e41788b80763f4f1a2a5981937dcca (diff) | |
download | elgg-f7fa53526b70e20ac09ccdda701ee2ede1887273.tar.gz elgg-f7fa53526b70e20ac09ccdda701ee2ede1887273.tar.bz2 |
Refs #235: Now possible for plugins to change default profile (plugin hook 'profile:fields', 'profile'.
git-svn-id: https://code.elgg.org/elgg/trunk@2232 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/profile/start.php | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/mod/profile/start.php b/mod/profile/start.php index ecaed078d..82dc80396 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -27,8 +27,11 @@ register_metadata_as_independent('user');
// For now, we'll hard code the profile items as follows:
- // TODO make this user configurable
- $CONFIG->profile = array(
+ // TODO make this user configurable + + +
+ /*$CONFIG->profile = array(
// Language short codes must be of the form "profile:key"
// where key is the array key below
@@ -42,7 +45,7 @@ 'mobile' => 'text',
'website' => 'url',
- );
+ );*/
// Register a page handler, so we can have nice URLs
register_page_handler('profile','profile_page_handler');
@@ -68,8 +71,36 @@ } // Now override icons - register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook');
- }
+ register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook'); + +
+ } + + /** + * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit + * add and delete fields. + * + * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all + * other plugins have initialised. + */ + function profile_fields_setup() + { + global $CONFIG; + + $profile_defaults = array ( + 'description' => 'longtext', + 'briefdescription' => 'text', + 'location' => 'tags', + 'interests' => 'tags', + 'skills' => 'tags', + 'contactemail' => 'email', + 'phone' => 'text', + 'mobile' => 'text', + 'website' => 'url', + ); + + $CONFIG->profile = trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults); + } /**
* Profile page handler
@@ -172,10 +203,12 @@ return $url; } } - }
+ } // 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_init',1); + register_elgg_event_handler('init','system','profile_fields_setup', 10000); +
// Register actions
global $CONFIG;
|