aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-13 14:06:26 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-13 14:06:26 +0000
commit25ccb63310662f852d247a432f6ad1644ac1fa11 (patch)
tree2e804cd61dbe42735b29d1b60aeed089378efa59 /mod/groups
parent7375953e51b7ed4d08df067527a7beff44ba2332 (diff)
downloadelgg-25ccb63310662f852d247a432f6ad1644ac1fa11.tar.gz
elgg-25ccb63310662f852d247a432f6ad1644ac1fa11.tar.bz2
Closes #432: Hook added as profile
git-svn-id: https://code.elgg.org/elgg/trunk@2246 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/start.php31
1 files 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');