56 $subscriptions = array();
58 if (!$this->methods) {
59 return $subscriptions;
64 return $subscriptions;
68 $prefixLength = strlen(self::RELATIONSHIP_PREFIX);
70 foreach ($records as $record) {
71 $deliveryMethods = explode(
',', $record->methods);
72 $subscriptions[$record->guid] = substr_replace($deliveryMethods,
'', 0, $prefixLength);
94 $subscriptions = array();
96 if (!$this->methods) {
97 return $subscriptions;
100 $prefixLength = strlen(self::RELATIONSHIP_PREFIX);
102 foreach ($records as $record) {
103 $deliveryMethods = explode(
',', $record->methods);
104 $subscriptions[$record->guid] = substr_replace($deliveryMethods,
'', 0, $prefixLength);
107 return $subscriptions;
121 if (!in_array(
$method, $this->methods)) {
124 $prefix = self::RELATIONSHIP_PREFIX;
137 $prefix = self::RELATIONSHIP_PREFIX;
159 array_walk($rels, array($this->db,
'sanitizeString'));
160 $methods_string =
"'" . implode(
"','", $rels) .
"'";
163 $query =
"SELECT guid_one AS guid, GROUP_CONCAT(relationship SEPARATOR ',') AS methods 164 FROM {$db_prefix}entity_relationships 165 WHERE guid_two = $container_guid AND 166 relationship IN ($methods_string) GROUP BY guid_one";
167 return $this->db->getData($query);
176 $prefix = self::RELATIONSHIP_PREFIX;
178 foreach ($this->methods as
$method) {
179 $names[] =
"$prefix$method";
getObject()
Get the object of the event.
$object
These two snippets demonstrates triggering an event and how to register for that event.
getSubscriptionsForContainer($container_guid)
Get the subscriptions for the content created inside this container.
add_entity_relationship($guid_one, $relationship, $guid_two)
Create a relationship between two entities.
remove_entity_relationship($guid_one, $relationship, $guid_two)
Delete a relationship between two entities.
const ORIGIN_SUBSCRIPTIONS
removeSubscription($userGuid, $method, $targetGuid)
Unsubscribe a user to notifications about a target entity.
__construct(Database $db, array $methods=array())
Constructor.
getSubscriptionRecords($container_guid)
Get subscription records from the database.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
addSubscription($userGuid, $method, $targetGuid)
Subscribe a user to notifications about a target entity.
getMethodRelationships()
Get the relationship names for notifications.
getSubscriptions(NotificationEvent $event)
Get the subscriptions for this notification event.
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
if(!$num_display) $db_prefix
const RELATIONSHIP_PREFIX
Elgg has historically stored subscriptions as relationships with the prefix 'notify'.