aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/start.php
diff options
context:
space:
mode:
authordave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-01 12:58:47 +0000
committerdave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-01 12:58:47 +0000
commite2ef6b4a49fdf4a8696dc9b2c4c6bff76df59fef (patch)
treed5f63931bbbe0eb10a17877ab7d62c6356c723ba /mod/groups/start.php
parent079a3a59fee4bcd9c3c749508ade6242ae1e0b43 (diff)
downloadelgg-e2ef6b4a49fdf4a8696dc9b2c4c6bff76df59fef.tar.gz
elgg-e2ef6b4a49fdf4a8696dc9b2c4c6bff76df59fef.tar.bz2
groups owners can choose if they want pages/files/forum enabled or not. Still a little more to do, this is just the beginning code.
git-svn-id: https://code.elgg.org/elgg/trunk@2526 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups/start.php')
-rw-r--r--mod/groups/start.php178
1 files changed, 90 insertions, 88 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 7bd6aca24..d8215ae2d 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -78,34 +78,34 @@
'interests' => 'tags',
'website' => 'url',
- );*/
-
- // Now override icons
+ );*/
+
+ // 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->group = trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults);
+ }
+
+ /**
+ * 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->group = trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults);
}
/**
@@ -141,7 +141,9 @@
}
}
- add_submenu_item(elgg_echo('groups:forum'),$CONFIG->wwwroot . "pg/groups/forum/{$page_owner->getGUID()}/", '1groupslinks');
+ if($page_owner->forum_enable == "yes"){
+ add_submenu_item(elgg_echo('groups:forum'),$CONFIG->wwwroot . "pg/groups/forum/{$page_owner->getGUID()}/", '1groupslinks');
+ }
}
@@ -222,27 +224,27 @@
}
}
- }
-
- /**
- * Handle group icons.
- *
- * @param unknown_type $page
- */
- function groups_icon_handler($page) {
-
- global $CONFIG;
-
- // The username should be the file we're getting
- if (isset($page[0])) {
- set_input('group_guid',$page[0]);
- }
- if (isset($page[1])) {
- set_input('size',$page[1]);
- }
- // Include the standard profile index
- include($CONFIG->pluginspath . "groups/graphics/icon.php");
-
+ }
+
+ /**
+ * Handle group icons.
+ *
+ * @param unknown_type $page
+ */
+ function groups_icon_handler($page) {
+
+ global $CONFIG;
+
+ // The username should be the file we're getting
+ if (isset($page[0])) {
+ set_input('group_guid',$page[0]);
+ }
+ if (isset($page[1])) {
+ set_input('size',$page[1]);
+ }
+ // Include the standard profile index
+ include($CONFIG->pluginspath . "groups/graphics/icon.php");
+
}
/**
@@ -359,44 +361,44 @@
return true;
- }
-
- /**
- * This hooks into the getIcon API and provides nice user icons for users where possible.
- *
- * @param unknown_type $hook
- * @param unknown_type $entity_type
- * @param unknown_type $returnvalue
- * @param unknown_type $params
- * @return unknown
- */
- function groups_groupicon_hook($hook, $entity_type, $returnvalue, $params)
- {
- global $CONFIG;
-
- if ((!$returnvalue) && ($hook == 'entity:icon:url') && ($params['entity'] instanceof ElggGroup))
- {
- $entity = $params['entity'];
- $type = $entity->type;
- $viewtype = $params['viewtype'];
- $size = $params['size'];
-
- if ($icontime = $entity->icontime) {
- $icontime = "{$icontime}";
- } else {
- $icontime = "default";
- }
-
- $filehandler = new ElggFile();
- $filehandler->owner_guid = $entity->owner_guid;
- $filehandler->setFilename("groups/" . $entity->guid . $size . ".jpg");
-
- if ($filehandler->exists()) {
- $url = $CONFIG->url . "pg/groupicon/{$entity->guid}/$size/$icontime.jpg";
-
- return $url;
- }
- }
+ }
+
+ /**
+ * This hooks into the getIcon API and provides nice user icons for users where possible.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+ function groups_groupicon_hook($hook, $entity_type, $returnvalue, $params)
+ {
+ global $CONFIG;
+
+ if ((!$returnvalue) && ($hook == 'entity:icon:url') && ($params['entity'] instanceof ElggGroup))
+ {
+ $entity = $params['entity'];
+ $type = $entity->type;
+ $viewtype = $params['viewtype'];
+ $size = $params['size'];
+
+ if ($icontime = $entity->icontime) {
+ $icontime = "{$icontime}";
+ } else {
+ $icontime = "default";
+ }
+
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $entity->owner_guid;
+ $filehandler->setFilename("groups/" . $entity->guid . $size . ".jpg");
+
+ if ($filehandler->exists()) {
+ $url = $CONFIG->url . "pg/groupicon/{$entity->guid}/$size/$icontime.jpg";
+
+ return $url;
+ }
+ }
}
// Register a handler for create groups
@@ -406,7 +408,7 @@
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');