54 $subscriptions = array();
56 if (!$this->methods) {
57 return $subscriptions;
62 return $subscriptions;
66 $prefixLength = strlen(self::RELATIONSHIP_PREFIX);
68 foreach ($records as $record) {
69 $deliveryMethods = explode(
',', $record->methods);
70 $subscriptions[$record->guid] = substr_replace($deliveryMethods,
'', 0, $prefixLength);
74 $params = array(
'event' => $event);
92 $subscriptions = array();
94 if (!$this->methods) {
95 return $subscriptions;
98 $prefixLength = strlen(self::RELATIONSHIP_PREFIX);
100 foreach ($records as $record) {
101 $deliveryMethods = explode(
',', $record->methods);
102 $subscriptions[$record->guid] = substr_replace($deliveryMethods,
'', 0, $prefixLength);
105 return $subscriptions;
119 if (!in_array(
$method, $this->methods)) {
122 $prefix = self::RELATIONSHIP_PREFIX;
135 $prefix = self::RELATIONSHIP_PREFIX;
157 array_walk($rels, array($this->db,
'sanitizeString'));
158 $methods_string =
"'" . implode(
"','", $rels) .
"'";
161 $query =
"SELECT guid_one AS guid, GROUP_CONCAT(relationship SEPARATOR ',') AS methods 162 FROM {$db_prefix}entity_relationships 163 WHERE guid_two = $container_guid AND 164 relationship IN ($methods_string) GROUP BY guid_one";
165 return $this->db->getData($query);
174 $prefix = self::RELATIONSHIP_PREFIX;
176 foreach ($this->methods as
$method) {
177 $names[] =
"$prefix$method";
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.
removeSubscription($userGuid, $method, $targetGuid)
Unsubscribe a user to notifications about a target entity.
getSubscriptions(\Elgg\Notifications\Event $event)
Get the subscriptions for this notification event.
__construct(\Elgg\Database $db, array $methods=array())
Constructor.
getSubscriptionRecords($container_guid)
Get subscription records from the database.
addSubscription($userGuid, $method, $targetGuid)
Subscribe a user to notifications about a target entity.
getMethodRelationships()
Get the relationship names for notifications.
if(!$num_display) $db_prefix
const RELATIONSHIP_PREFIX
Elgg has historically stored subscriptions as relationships with the prefix 'notify'.