aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-20 16:12:15 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-20 16:12:15 +0000
commiteb36e7609f60704a26b08e404a230dba18b328ac (patch)
treed306f8ecd6850b42e35637c738be2fe0517a7d10 /mod/groups
parent85ddc49496f801173ebf9bd1ad9532c394921692 (diff)
downloadelgg-eb36e7609f60704a26b08e404a230dba18b328ac.tar.gz
elgg-eb36e7609f60704a26b08e404a230dba18b328ac.tar.bz2
Forum topic notifications fix.
git-svn-id: https://code.elgg.org/elgg/trunk@2869 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/start.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php
index e0bb18b92..9bfa077b3 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -67,7 +67,6 @@
// 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');
register_plugin_hook('object:notifications','object','group_object_notifications_intercept');
// Listen to notification events and supply a more useful message
@@ -82,12 +81,12 @@
*
*/
function group_object_notifications($event, $object_type, $object) {
-
if (is_callable('object_notifications'))
if ($object instanceof ElggObject) {
if ($object->getSubtype() == 'groupforumtopic') {
- if ($object->countAnnotations() > 0)
+ if ($object->countAnnotations('group_topic_post') > 0) {
object_notifications($event, $object_type, $object);
+ }
}
}
@@ -129,16 +128,21 @@
$method = $params['method'];
if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'groupforumtopic'))
{
+
$descr = $entity->description;
$title = $entity->title;
global $CONFIG;
$url = $entity->getURL();
+
+ $msg = get_input('topicmessage');
+ if (empty($msg)) $msg = get_input('topic_post');
+ if (!empty($msg)) $msg = $msg . "\n\n"; else $msg = '';
+
$owner = get_entity($entity->container_guid);
if ($method == 'sms') {
return elgg_echo("groupforumtopic:new") . ': ' . $url . " ({$owner->name}: {$title})";
} else {
- $owner = $entity->getOwnerEntity();
- return $owner->username . ' ' . elgg_echo("groups:viagroups") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ return $owner->username . ' ' . elgg_echo("groups:viagroups") . ': ' . $title . "\n\n" . $msg . "\n\n" . $entity->getURL();
}
}
@@ -475,6 +479,7 @@
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');
+ register_elgg_event_handler('annotate','all','group_object_notifications');
// Register actions
global $CONFIG;