aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/groups/languages/en.php2
-rw-r--r--mod/groups/start.php65
2 files changed, 53 insertions, 14 deletions
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index 4a0829fee..8f3d49a78 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -55,6 +55,8 @@
'groups:notfound:details' => "The requested group either does not exist or you do not have access to it",
'item:object:groupforumtopic' => "Forum topics",
+
+ 'groupforumtopic:new' => "New forum post",
/*
Group tools
diff --git a/mod/groups/start.php b/mod/groups/start.php
index cd1150a58..fbace7971 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -66,26 +66,63 @@
// Write access permissions
register_plugin_hook('access:collections:write', 'all', 'groups_write_acl_plugin_hook');
- // For now, we'll hard code the groups profile items as follows:
- // TODO make this user configurable
-
- // Language short codes must be of the form "groups:key"
- // where key is the array key below
- /*$CONFIG->group = array(
-
- 'name' => 'text',
- 'description' => 'longtext',
- 'briefdescription' => 'text',
- 'interests' => 'tags',
- 'website' => 'url',
-
- );*/
+ // Notification hooks
+ if (is_callable('register_notification_object'))
+ register_notification_object('object', 'groupforumtopic', elgg_echo('groupforumtopic:new'));
+ register_elgg_event_handler('annotate','all','group_object_notifications');
+ // Listen to notification events and supply a more useful message
+ register_plugin_hook('notify:entity:message', 'object', 'groupforumtopic_notify_message');
+
// Now override icons
register_plugin_hook('entity:icon:url', 'group', 'groups_groupicon_hook');
}
/**
+ * Event handler for group forum posts
+ *
+ */
+ function group_object_notifications($event, $object_type, $object) {
+
+ if (is_callable('object_notifications'))
+ if ($object instanceof ElggObject) {
+ if ($object->getSubtype() == 'groupforumtopic') {
+ object_notifications($event, $object_type, $object);
+ }
+ }
+
+ }
+
+ /**
+ * Returns a more meaningful message
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ */
+ function groupforumtopic_notify_message($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $to_entity = $params['to_entity'];
+ $method = $params['method'];
+ if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'groupforumtopic'))
+ {
+ $descr = $entity->description;
+ $title = $entity->title;
+ global $CONFIG;
+ $url = $entity->getURL();
+ $owner = get_entity($entity->container_guid);
+ if ($method == 'sms') {
+ return elgg_echo("groupforumtopic:new") . ': ' . $url . " ({$owner->name}: {$title})";
+ } else {
+ return "{$title}\n({$owner->name})\n\n{$url}";
+ }
+ }
+ return null;
+ }
+
+ /**
* This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit
* add and delete fields.
*