diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-02-09 18:16:06 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-02-09 18:16:06 +0000 |
commit | 200d821e40d08c8acd1aa042b253d4d773765bc6 (patch) | |
tree | 817d09948121bc391eb61c3c26ffdab22a068397 /mod/groups | |
parent | 6d3821d6ef360adb892267dbdeeea0eb43ffea05 (diff) | |
download | elgg-200d821e40d08c8acd1aa042b253d4d773765bc6.tar.gz elgg-200d821e40d08c8acd1aa042b253d4d773765bc6.tar.bz2 |
A single notification is now sent out on forum topic creation.
This also contains an update to $entity->countAnnotations, which no longer requires you to specify the annotation type.
git-svn-id: https://code.elgg.org/elgg/trunk@2699 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups')
-rw-r--r-- | mod/groups/start.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php index fbace7971..ee4c3d319 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -70,6 +70,7 @@ if (is_callable('register_notification_object'))
register_notification_object('object', 'groupforumtopic', elgg_echo('groupforumtopic:new'));
register_elgg_event_handler('annotate','all','group_object_notifications');
+ register_plugin_hook('object:notifications','object','group_object_notifications_intercept');
// Listen to notification events and supply a more useful message
register_plugin_hook('notify:entity:message', 'object', 'groupforumtopic_notify_message');
@@ -87,12 +88,34 @@ if (is_callable('object_notifications'))
if ($object instanceof ElggObject) {
if ($object->getSubtype() == 'groupforumtopic') {
- object_notifications($event, $object_type, $object);
+ if ($object->countAnnotations() > 0)
+ object_notifications($event, $object_type, $object);
}
}
}
+ /**
+ * Intercepts the notification on group topic creation and prevents a notification from going out
+ * (because one will be sent on the annotation)
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+ function group_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
+ if (isset($params)) {
+ if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {
+ if ($params['object']->getSubtype() == 'groupforumtopic') {
+ return true;
+ }
+ }
+ }
+ return null;
+ }
+
/**
* Returns a more meaningful message
*
|