54 $subscriptions = array();
56 if (!$this->methods) {
57 return $subscriptions;
62 return $subscriptions;
65 $prefixLength = strlen(self::RELATIONSHIP_PREFIX);
67 foreach ($records as $record) {
68 $deliveryMethods = explode(
',', $record->methods);
69 $subscriptions[$record->guid] = substr_replace($deliveryMethods,
'', 0, $prefixLength);
72 $params = array(
'event' => $event);
90 $subscriptions = array();
92 if (!$this->methods) {
93 return $subscriptions;
96 $prefixLength = strlen(self::RELATIONSHIP_PREFIX);
98 foreach ($records as $record) {
99 $deliveryMethods = explode(
',', $record->methods);
100 $subscriptions[$record->guid] = substr_replace($deliveryMethods,
'', 0, $prefixLength);
103 return $subscriptions;
117 if (!in_array(
$method, $this->methods)) {
120 $prefix = self::RELATIONSHIP_PREFIX;
133 $prefix = self::RELATIONSHIP_PREFIX;
155 array_walk($rels, array($this->db,
'sanitizeString'));
156 $methods_string =
"'" . implode(
"','", $rels) .
"'";
159 $query =
"SELECT guid_one AS guid, GROUP_CONCAT(relationship SEPARATOR ',') AS methods 160 FROM {$db_prefix}entity_relationships 161 WHERE guid_two = $container_guid AND 162 relationship IN ($methods_string) GROUP BY guid_one";
163 return $this->db->getData($query);
172 $prefix = self::RELATIONSHIP_PREFIX;
174 foreach ($this->methods as
$method) {
175 $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'.