/** * Get the subscriptions for this notification event * * The return array is of the form: * * array( * <user guid> => array('email', 'sms', 'ajax'), * ); * * @param Elgg_Notifications_Event $event Notification event * @return array */ public function getSubscriptions(Elgg_Notifications_Event $event) { $subscriptions = array(); if (!$this->methods) { return $subscriptions; } $object = $event->getObject(); if (!$object) { return $subscriptions; } $prefixLength = strlen(self::RELATIONSHIP_PREFIX); $records = $this->getSubscriptionRecords($object->getContainerGUID()); foreach ($records as $record) { $deliveryMethods = explode(',', $record->methods); $subscriptions[$record->guid] = substr_replace($deliveryMethods, '', 0, $prefixLength); } $params = array('event' => $event); return elgg_trigger_plugin_hook('get', 'subscriptions', $params, $subscriptions); }
/** * Is someone using the deprecated override * * @param Elgg_Notifications_Event $event Event * @return boolean */ protected function existsDeprecatedNotificationOverride(Elgg_Notifications_Event $event) { $entity = $event->getObject(); if (!elgg_instanceof($entity)) { return false; } $params = array('event' => $event->getAction(), 'object_type' => $entity->getType(), 'object' => $entity); $hookresult = $this->hooks->trigger('object:notifications', $entity->getType(), $params, false); if ($hookresult === true) { elgg_deprecated_notice("Using the plugin hook 'object:notifications' has been deprecated by the hook 'send:before', 'notifications'", 1.9); return true; } else { return false; } }