From 25ccb63310662f852d247a432f6ad1644ac1fa11 Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 13 Oct 2008 14:06:26 +0000 Subject: Closes #432: Hook added as profile git-svn-id: https://code.elgg.org/elgg/trunk@2246 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/groups/start.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/mod/groups/start.php b/mod/groups/start.php index 780e06d6f..4b3fb42ac 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -70,7 +70,7 @@ // Language short codes must be of the form "groups:key" // where key is the array key below - $CONFIG->group = array( + /*$CONFIG->group = array( 'name' => 'text', 'description' => 'longtext', @@ -78,10 +78,34 @@ 'interests' => 'tags', 'website' => 'url', - ); + );*/ // Now override icons register_plugin_hook('entity:icon:url', 'group', 'groups_groupicon_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 groups_fields_setup() + { + global $CONFIG; + + $profile_defaults = array( + + 'name' => 'text', + 'description' => 'longtext', + 'briefdescription' => 'text', + 'interests' => 'tags', + 'website' => 'url', + + ); + + $CONFIG->profile = trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults); } /** @@ -381,7 +405,8 @@ register_elgg_event_handler('delete', 'group', 'groups_delete_event_listener'); // Make sure the groups initialisation function is called on initialisation - register_elgg_event_handler('init','system','groups_init'); + register_elgg_event_handler('init','system','groups_init'); + register_elgg_event_handler('init','system','groups_fields_setup', 10000); // Ensure this runs after other plugins register_elgg_event_handler('join','group','groups_user_join_event_listener'); register_elgg_event_handler('leave','group','groups_user_leave_event_listener'); register_elgg_event_handler('pagesetup','system','groups_submenus'); -- cgit v1.2.3