diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2012-02-21 23:19:32 -0800 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2012-02-21 23:19:32 -0800 |
commit | 6c7ff96f073dc35a9e43e80e80121f2b0463b06d (patch) | |
tree | c9e64bb5af69d0bcf2318c42c2d390fd9321403d /mod/groups | |
parent | 536c037bfa6a04a2a08db94330c9a12fe22cd6cb (diff) | |
download | elgg-6c7ff96f073dc35a9e43e80e80121f2b0463b06d.tar.gz elgg-6c7ff96f073dc35a9e43e80e80121f2b0463b06d.tar.bz2 |
Refs #4335. Updated discussion notifications.
Diffstat (limited to 'mod/groups')
-rw-r--r-- | mod/groups/languages/en.php | 10 | ||||
-rw-r--r-- | mod/groups/start.php | 54 |
2 files changed, 24 insertions, 40 deletions
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index a4a9e2b2b..e51e51a14 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -64,6 +64,16 @@ $english = array( 'groups:search_in_group' => "Search in this group", 'groups:acl' => "Group: %s", + 'groups:notification' => +'%s added a new discussion topic to %s: + +%s +%s + +View and reply to the discussion: +%s +', + 'groups:activity' => "Group activity", 'groups:enableactivity' => 'Enable group activity', 'groups:activity:none' => "There is no group activity yet", diff --git a/mod/groups/start.php b/mod/groups/start.php index 86a1da279..aeab0649a 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -741,7 +741,6 @@ function discussion_init() { // notifications register_notification_object('object', 'groupforumtopic', elgg_echo('groupforumtopic:new')); - elgg_register_plugin_hook_handler('object:notifications', 'object', 'group_object_notifications_intercept'); elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'groupforumtopic_notify_message'); } @@ -855,41 +854,19 @@ function discussion_add_to_river_menu($hook, $type, $return, $params) { function group_object_notifications($event, $object_type, $object) { static $flag; - if (!isset($flag)) + if (!isset($flag)) { $flag = 0; + } if (is_callable('object_notifications')) if ($object instanceof ElggObject) { if ($object->getSubtype() == 'groupforumtopic') { - //if ($object->countAnnotations('group_topic_post') > 0) { if ($flag == 0) { $flag = 1; 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; } /** @@ -904,26 +881,23 @@ function groupforumtopic_notify_message($hook, $entity_type, $returnvalue, $para $entity = $params['entity']; $to_entity = $params['to_entity']; $method = $params['method']; - if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'groupforumtopic')) { + if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'groupforumtopic')) { $descr = $entity->description; $title = $entity->title; $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 { - return elgg_get_logged_in_user_entity()->name . ' ' . elgg_echo("groups:viagroups") . ': ' . $title . "\n\n" . $msg . "\n\n" . $entity->getURL(); - } + $owner = $entity->getOwnerEntity(); + $group = $entity->getContainerEntity(); + + return elgg_echo('groups:notification', array( + $owner->name, + $group->name, + $entity->title, + $entity->description, + $entity->getURL() + )); } + return null; } |