59 if (empty($this->methods)) {
70 $prefixLength = strlen(self::RELATIONSHIP_PREFIX);
72 foreach ($records as $record) {
73 $deliveryMethods = explode(
',', $record->methods);
74 $subscriptions[$record->guid] = substr_replace($deliveryMethods,
'', 0, $prefixLength);
101 if (empty($this->methods)) {
102 return $subscriptions;
105 $prefixLength = strlen(self::RELATIONSHIP_PREFIX);
107 foreach ($records as $record) {
108 $deliveryMethods = explode(
',', $record->methods);
109 $subscriptions[$record->guid] = substr_replace($deliveryMethods,
'', 0, $prefixLength);
112 return $subscriptions;
126 if (!in_array($method, $this->methods)) {
129 $prefix = self::RELATIONSHIP_PREFIX;
142 $prefix = self::RELATIONSHIP_PREFIX;
164 array_walk($rels, [$this->db,
'sanitizeString']);
165 $methods_string =
"'" . implode(
"','", $rels) .
"'";
167 $db_prefix = $this->db->prefix;
168 $query =
"SELECT guid_one AS guid, GROUP_CONCAT(relationship SEPARATOR ',') AS methods 169 FROM {$db_prefix}entity_relationships 170 WHERE guid_two = $container_guid AND 171 relationship IN ($methods_string) GROUP BY guid_one";
172 return $this->db->getData(
$query);
181 $prefix = self::RELATIONSHIP_PREFIX;
183 foreach ($this->methods as $method) {
184 $names[] =
"$prefix$method";
getObject()
Get the object of the event.
if(!$item instanceof ElggRiverItem) $object
$params
Saves global plugin settings.
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=[])
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.
_elgg_services()
Get the global service provider.
getSubscriptions(NotificationEvent $event)
Get the subscriptions for this notification event.
const RELATIONSHIP_PREFIX
Elgg has historically stored subscriptions as relationships with the prefix 'notify'.