Elgg  Version 7.1
SubscriptionsService.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Notifications;
4 
5 use Elgg\Database;
13 
21 
25  const RELATIONSHIP_PREFIX = 'notify';
26 
30  const MUTE_NOTIFICATIONS_RELATIONSHIP = 'mute_notifications';
31 
39  public function __construct(
40  protected Database $db,
41  protected RelationshipsTable $relationshipsTable,
42  protected EventsService $events
43  ) {
44  }
45 
61  public function getNotificationEventSubscriptions(NotificationEvent $event, array $methods, array $exclude_guids_for_records = []) {
62 
63  if (empty($methods)) {
64  return [];
65  }
66 
67  $object = $event->getObject();
68  if (!$object instanceof \ElggData) {
69  return [];
70  }
71 
72  // get subscribers only for \ElggEntity if it isn't private
73  if (!$object instanceof \ElggEntity || $object->access_id === ACCESS_PRIVATE) {
74  return [];
75  }
76 
77  $guids = [
78  $object->owner_guid,
79  $object->container_guid,
80  ];
81  if ($object instanceof \ElggObject || $object instanceof \ElggGroup) {
82  $guids[] = $object->guid;
83  }
84 
85  $guids = array_diff($guids, $exclude_guids_for_records);
86  if (empty($guids)) {
87  return [];
88  }
89 
90  $subscriptions = [];
91  $records = $this->getSubscriptionRecords($guids, $methods, $object->type, $object->subtype, $event->getAction(), $event->getActorGUID());
92  foreach ($records as $record) {
93  if (empty($record->guid)) {
94  // happens when no records are found
95  continue;
96  }
97 
98  if (!isset($subscriptions[$record->guid])) {
99  $subscriptions[$record->guid] = [];
100  }
101 
102  $deliveryMethods = explode(',', $record->methods);
103  foreach ($deliveryMethods as $relationship) {
104  $relationship_array = explode(':', $relationship);
105 
106  $subscriptions[$record->guid][] = end($relationship_array);
107  }
108  }
109 
110  return $subscriptions;
111  }
112 
131  public function getSubscriptionsForContainer(int $container_guid, array $methods, ?string $type = null, ?string $subtype = null, ?string $action = null, int $actor_guid = 0) {
132 
133  if (empty($methods)) {
134  return [];
135  }
136 
137  $subscriptions = [];
138 
139  $records = $this->getSubscriptionRecords([$container_guid], $methods, $type, $subtype, $action, $actor_guid);
140  foreach ($records as $record) {
141  if (empty($record->guid)) {
142  // happens when no records are found
143  continue;
144  }
145 
146  if (!isset($subscriptions[$record->guid])) {
147  $subscriptions[$record->guid] = [];
148  }
149 
150  $deliveryMethods = explode(',', $record->methods);
151  foreach ($deliveryMethods as $relationship) {
152  $relationship_array = explode(':', $relationship);
153 
154  $subscriptions[$record->guid][] = end($relationship_array);
155  }
156  }
157 
158  return $subscriptions;
159  }
160 
176  public function addSubscription(int $user_guid, string $method, int $target_guid, ?string $type = null, ?string $subtype = null, ?string $action = null) {
178 
179  if (!_elgg_services()->notifications->isRegisteredMethod($method)) {
180  return false;
181  }
182 
183  // remove the muted notification relationship
184  $this->unmuteNotifications($user_guid, $target_guid);
185 
186  $relationship = new \ElggRelationship();
187  $relationship->guid_one = $user_guid;
188  $relationship->relationship = $this->getSubscriptionRelationshipName($method, $type, $subtype, $action);
189  $relationship->guid_two = $target_guid;
190 
191  return $relationship->save();
192  }
193 
202  public function getSubscriptionRelationshipName(string $method, ?string $type = null, ?string $subtype = null, ?string $action = null): string {
203  $rel = [
204  self::RELATIONSHIP_PREFIX,
205  ];
206 
207  if (!empty($type) && !empty($subtype) && !empty($action)) {
208  $rel[] = $type;
209  $rel[] = $subtype;
210  $rel[] = $action;
211  }
212 
213  $rel[] = $method;
214 
215  return implode(':', $rel);
216  }
217 
232  public function hasSubscription(int $user_guid, string $method, int $target_guid, ?string $type = null, ?string $subtype = null, ?string $action = null): bool {
233  $this->assertValidTypeSubtypeActionForSubscription($type, $subtype, $action);
234 
235  return $this->relationshipsTable->check($user_guid, $this->getSubscriptionRelationshipName($method, $type, $subtype, $action), $target_guid) instanceof \ElggRelationship;
236  }
237 
248  public function hasSubscriptions(int $user_guid, int $target_guid, array $methods = []): bool {
249  if (empty($methods)) {
250  // all currently registered methods
251  $methods = _elgg_services()->notifications->getMethods();
252  }
253 
254  if (empty($methods)) {
255  // no methods available
256  return false;
257  }
258 
259  $select = Select::fromTable(RelationshipsTable::TABLE_NAME);
260  $select->select('count(*) as total')
261  ->where($select->compare('guid_one', '=', $user_guid, ELGG_VALUE_GUID))
262  ->andWhere($select->compare('guid_two', '=', $target_guid, ELGG_VALUE_GUID));
263 
264  $ors = [];
265  foreach ($methods as $method) {
266  $ors[] = $select->compare('relationship', '=', self::RELATIONSHIP_PREFIX . ':' . $method, ELGG_VALUE_STRING);
267  $ors[] = $select->compare('relationship', 'like', self::RELATIONSHIP_PREFIX . ':%:' . $method, ELGG_VALUE_STRING);
268  }
269 
270  $select->andWhere($select->merge($ors, 'OR'));
271 
272  $result = $this->db->getDataRow($select);
273 
274  return (bool) $result->total;
275  }
276 
290  public function removeSubscription(int $user_guid, string $method, int $target_guid, ?string $type = null, ?string $subtype = null, ?string $action = null) {
291  $this->assertValidTypeSubtypeActionForSubscription($type, $subtype, $action);
292 
293  $relationship_name = $this->getSubscriptionRelationshipName($method, $type, $subtype, $action);
294  if (!$this->relationshipsTable->check($user_guid, $relationship_name, $target_guid)) {
295  // subscription doesn't exist
296  return true;
297  }
298 
299  return $this->relationshipsTable->remove($user_guid, $relationship_name, $target_guid);
300  }
301 
312  public function removeSubscriptions(int $user_guid, int $target_guid, array $methods = []): bool {
313  $delete = Delete::fromTable(RelationshipsTable::TABLE_NAME);
314  $delete->where($delete->compare('guid_one', '=', $user_guid, ELGG_VALUE_GUID))
315  ->andWhere($delete->compare('guid_two', '=', $target_guid, ELGG_VALUE_GUID));
316 
317  if (empty($methods)) {
318  $delete->andWhere($delete->compare('relationship', 'like', self::RELATIONSHIP_PREFIX . ':%', ELGG_VALUE_STRING));
319  } else {
320  $ors = [];
321  foreach ($methods as $method) {
322  $ors[] = $delete->compare('relationship', '=', self::RELATIONSHIP_PREFIX . ':' . $method, ELGG_VALUE_STRING);
323  $ors[] = $delete->compare('relationship', 'like', self::RELATIONSHIP_PREFIX . ':%:' . $method, ELGG_VALUE_STRING);
324  }
325 
326  $delete->andWhere($delete->merge($ors, 'OR'));
327  }
328 
329  return (bool) $this->db->deleteData($delete);
330  }
331 
340  public function getSubscribers(int $target_guid, array $methods = []): array {
342  'limit' => false,
343  'wheres' => [
344  function(QueryBuilder $qb, $main_alias) use ($target_guid) {
345  $rel = $qb->joinRelationshipTable($main_alias, 'guid', null, true);
346 
347  return $qb->compare("{$rel}.guid_two", '=', $target_guid, ELGG_VALUE_GUID);
348  },
349  function(QueryBuilder $qb, $main_alias) use ($methods) {
350  $rel = $qb->joinRelationshipTable($main_alias, 'guid', null, true);
351 
352  if (empty($methods)) {
353  return $qb->compare("{$rel}.relationship", 'like', self::RELATIONSHIP_PREFIX . ':%', ELGG_VALUE_STRING);
354  }
355 
356  $ors = [];
357  foreach ($methods as $method) {
358  $ors[] = $qb->compare("{$rel}.relationship", '=', self::RELATIONSHIP_PREFIX . ':' . $method, ELGG_VALUE_STRING);
359  $ors[] = $qb->compare("{$rel}.relationship", 'like', self::RELATIONSHIP_PREFIX . ':%:' . $method, ELGG_VALUE_STRING);
360  }
361 
362  return $qb->merge($ors, 'OR');
363  },
364  ],
365  ]);
366  }
367 
381  public function getEntitySubscriptions(int $target_guid = 0, int $user_guid = 0, array $methods = [], ?string $type = null, ?string $subtype = null, ?string $action = null): array {
382  $this->assertValidTypeSubtypeActionForSubscription($type, $subtype, $action);
383 
384  if (empty($target_guid) && empty($user_guid)) {
385  return [];
386  }
387 
388  if (empty($target_guid)) {
390  }
391 
392  return elgg_get_relationships([
393  'limit' => false,
394  'wheres' => [
395  function(QueryBuilder $qb, $main_alias) use ($target_guid) {
396  if (empty($target_guid)) {
397  return;
398  }
399 
400  return $qb->compare("{$main_alias}.guid_two", '=', $target_guid, ELGG_VALUE_GUID);
401  },
402  function(QueryBuilder $qb, $main_alias) use ($user_guid) {
403  if (empty($user_guid)) {
404  return;
405  }
406 
407  return $qb->compare("{$main_alias}.guid_one", '=', $user_guid, ELGG_VALUE_GUID);
408  },
409  function(QueryBuilder $qb, $main_alias) use ($methods, $type, $subtype, $action) {
410  if (empty($methods) && (empty($type) || empty($subtype) || empty($action))) {
411  return $qb->compare("{$main_alias}.relationship", 'like', self::RELATIONSHIP_PREFIX . ':%', ELGG_VALUE_STRING);
412  }
413 
414  if (!empty($methods)) {
415  if (empty($type) || empty($subtype) || empty($action)) {
416  // only methods
417  $ors = [];
418  foreach ($methods as $method) {
419  $ors[] = $qb->compare("{$main_alias}.relationship", '=', self::RELATIONSHIP_PREFIX . ':' . $method, ELGG_VALUE_STRING);
420  $ors[] = $qb->compare("{$main_alias}.relationship", 'like', self::RELATIONSHIP_PREFIX . ':%:' . $method, ELGG_VALUE_STRING);
421  }
422 
423  return $qb->merge($ors, 'OR');
424  } else {
425  // with type limitation
426  return $qb->compare("{$main_alias}.relationship", 'in', $this->getMethodRelationships($methods, $type, $subtype, $action), ELGG_VALUE_STRING);
427  }
428  }
429 
430  // only type limitation
431  return $qb->compare("{$main_alias}.relationship", 'like', self::RELATIONSHIP_PREFIX . ":{$type}:{$subtype}:{$action}:%", ELGG_VALUE_STRING);
432  },
433  ],
434  ]);
435  }
436 
445  public function muteNotifications(int $user_guid, int $target_guid): bool {
446  // remove all current subscriptions
447  $this->removeSubscriptions($user_guid, $target_guid);
448 
449  $rel = new \ElggRelationship();
450  $rel->guid_one = $user_guid;
451  $rel->relationship = self::MUTE_NOTIFICATIONS_RELATIONSHIP;
452  $rel->guid_two = $target_guid;
453 
454  return $rel->save();
455  }
456 
465  public function unmuteNotifications(int $user_guid, int $target_guid): bool {
466  return $this->relationshipsTable->remove($user_guid, self::MUTE_NOTIFICATIONS_RELATIONSHIP, $target_guid);
467  }
468 
477  public function hasMutedNotifications(int $user_guid, int $target_guid): bool {
478  return $this->relationshipsTable->check($user_guid, self::MUTE_NOTIFICATIONS_RELATIONSHIP, $target_guid) instanceof \ElggRelationship;
479  }
480 
490  public function filterSubscriptions(array $subscriptions, NotificationEvent $event, bool $filter_muted = true): array {
491  // sanitize
492  // make methods unique and remove empties
493  $subscriptions = array_map(function($user_methods) {
494  return array_values(array_filter(array_unique($user_methods)));
495  }, $subscriptions);
496  $subscriptions = $this->filterDelayedEmailSubscribers($subscriptions);
497 
498  // apply filters
499  if ($filter_muted) {
500  $subscriptions = $this->filterMutedNotifications($subscriptions, $event);
501  $subscriptions = $this->filterTimedMutedSubscribers($subscriptions);
502  }
503 
504  return $subscriptions;
505  }
506 
521  protected function filterMutedNotifications(array $subscriptions, NotificationEvent $event): array {
522  $guids_to_check = [];
523 
524  // Event actor
525  $guids_to_check[] = $event->getActorGUID();
526 
527  // Event object
528  $entity = false;
529  $object = $event->getObject();
530  if ($object instanceof \ElggEntity) {
531  $entity = $object;
532  } elseif ($object instanceof \ElggAnnotation) {
533  $entity = $object->getEntity();
534  }
535 
536  if ($entity instanceof \ElggEntity) {
537  $guids_to_check[] = $entity->guid;
538  $guids_to_check[] = $entity->owner_guid;
539  $guids_to_check[] = $entity->container_guid;
540  }
541 
542  // are there GUIDs to check
543  $guids_to_check = array_filter($guids_to_check);
544  if (empty($guids_to_check)) {
545  return $subscriptions;
546  }
547 
548  // get muted relations
549  $select = Select::fromTable(RelationshipsTable::TABLE_NAME);
550  $select->select('guid_one')
551  ->where($select->compare('relationship', '=', self::MUTE_NOTIFICATIONS_RELATIONSHIP, ELGG_VALUE_STRING))
552  ->andWhere($select->compare('guid_two', 'in', $guids_to_check, ELGG_VALUE_GUID));
553 
554  $muted = $this->db->getData($select, function($row) {
555  return (int) $row->guid_one;
556  });
557 
558  // filter subscriptions
559  return array_diff_key($subscriptions, array_flip($muted));
560  }
561 
569  protected function filterDelayedEmailSubscribers(array $subscriptions): array {
570  return array_map(function ($user_methods) {
571  if (!in_array('delayed_email', $user_methods) || !in_array('email', $user_methods)) {
572  return $user_methods;
573  }
574 
575  $pos = array_search('delayed_email', $user_methods);
576  unset($user_methods[$pos]);
577 
578  return array_values($user_methods);
579  }, $subscriptions);
580  }
581 
589  protected function filterTimedMutedSubscribers(array $subscriptions): array {
590  $muted = Entities::find([
591  'type' => 'user',
592  'guids' => array_keys($subscriptions),
593  'limit' => false,
594  'callback' => function ($row) {
595  return (int) $row->guid;
596  },
597  'metadata_name_value_pairs' => [
598  [
599  'name' => 'timed_muting_start',
600  'value' => time(),
601  'operand' => '<=',
602  ],
603  [
604  'name' => 'timed_muting_end',
605  'value' => time(),
606  'operand' => '>=',
607  ],
608  ],
609  ]);
610 
611  return array_diff_key($subscriptions, array_flip($muted));
612  }
613 
629  protected function getSubscriptionRecords(array $container_guid, array $methods, ?string $type = null, ?string $subtype = null, ?string $action = null, int $actor_guid = 0): array {
630  // create IN clause
631  $rels = $this->getMethodRelationships($methods, $type, $subtype, $action);
632  if (!$rels) {
633  return [];
634  }
635 
636  $container_guid = array_unique(array_filter($container_guid));
637  if (empty($container_guid)) {
638  return [];
639  }
640 
641  $select = Select::fromTable(RelationshipsTable::TABLE_NAME);
642  $select->select('guid_one AS guid')
643  ->addSelect("GROUP_CONCAT(relationship SEPARATOR ',') AS methods")
644  ->where($select->compare('guid_two', 'in', $container_guid, ELGG_VALUE_GUID))
645  ->andWhere($select->compare('relationship', 'in', $rels, ELGG_VALUE_STRING))
646  ->groupBy('guid_one');
647 
648  if (!empty($actor_guid)) {
649  $select->andWhere($select->compare('guid_one', '!=', $actor_guid, ELGG_VALUE_GUID));
650  }
651 
652  return $this->db->getData($select);
653  }
654 
665  protected function getMethodRelationships(array $methods, ?string $type = null, ?string $subtype = null, ?string $action = null): array {
666  $prefix = self::RELATIONSHIP_PREFIX;
667 
668  $names = [];
669  foreach ($methods as $method) {
670  $names[] = "{$prefix}:{$method}";
671 
672  if (!empty($type) && !empty($subtype) && !empty($action)) {
673  $names[] = "{$prefix}:{$type}:{$subtype}:{$action}:{$method}";
674  }
675  }
676 
677  return $names;
678  }
679 
691  if (empty($type) && empty($subtype) && empty($action)) {
692  // all empty, this is valid
693  return;
694  }
695 
696  if (!empty($type) && !empty($subtype) && !empty($action)) {
697  // all set, also valid
698  return;
699  }
700 
701  throw new InvalidArgumentException('$type, $subtype and $action need to all be empty or all have a value');
702  }
703 }
$entity
Definition: reset.php:8
$subtype
Definition: delete.php:22
$type
Definition: delete.php:21
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/clear'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin', 'controller'=> \Elgg\Diagnostics\DownloadController::class,], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
Definition: actions.php:76
$guids
Activates all specified installed and inactive plugins.
Definition: activate_all.php:9
$delete
Entity Annotation.
A generic class that contains shared code among \ElggExtender, \ElggEntity, and \ElggRelationship.
Definition: ElggData.php:12
Query builder for updating data in the database.
Definition: Delete.php:8
Entities repository contains methods for fetching entities from database or performing calculations o...
Definition: Entities.php:19
Database abstraction query builder.
Relationships table database service.
Query builder for fetching data from the database.
Definition: Select.php:8
The Elgg database.
Definition: Database.php:26
Events service.
Exception thrown if an argument is not of the expected type.
removeSubscription(int $user_guid, string $method, int $target_guid, ?string $type=null, ?string $subtype=null, ?string $action=null)
Unsubscribe a user to notifications about a target entity.
getEntitySubscriptions(int $target_guid=0, int $user_guid=0, array $methods=[], ?string $type=null, ?string $subtype=null, ?string $action=null)
Get the current subscriptions for the given entity.
addSubscription(int $user_guid, string $method, int $target_guid, ?string $type=null, ?string $subtype=null, ?string $action=null)
Subscribe a user to notifications about a target entity.
getMethodRelationships(array $methods, ?string $type=null, ?string $subtype=null, ?string $action=null)
Get the relationship names for notifications.
assertValidTypeSubtypeActionForSubscription($type, $subtype, $action)
Validate subscription input for type, subtype and action.
removeSubscriptions(int $user_guid, int $target_guid, array $methods=[])
Unsubscribe a user from all notifications about the target entity.
getSubscriptionRecords(array $container_guid, array $methods, ?string $type=null, ?string $subtype=null, ?string $action=null, int $actor_guid=0)
Get subscription records from the database.
filterTimedMutedSubscribers(array $subscriptions)
Filter users who have set a period in which not to receive notifications.
muteNotifications(int $user_guid, int $target_guid)
Mute notifications about events affecting the target.
hasMutedNotifications(int $user_guid, int $target_guid)
Check if the user has notifications muted about events affecting the target.
getNotificationEventSubscriptions(NotificationEvent $event, array $methods, array $exclude_guids_for_records=[])
Get the subscriptions for this notification event.
filterMutedNotifications(array $subscriptions, NotificationEvent $event)
Filter subscriptions based on muted notification settings related to the notification event.
hasSubscription(int $user_guid, string $method, int $target_guid, ?string $type=null, ?string $subtype=null, ?string $action=null)
Check if a subscription exists.
hasSubscriptions(int $user_guid, int $target_guid, array $methods=[])
Check if any subscription exists.
getSubscribers(int $target_guid, array $methods=[])
Get all subscribers of the target guid.
__construct(protected Database $db, protected RelationshipsTable $relationshipsTable, protected EventsService $events)
Constructor.
getSubscriptionsForContainer(int $container_guid, array $methods, ?string $type=null, ?string $subtype=null, ?string $action=null, int $actor_guid=0)
Get the subscriptions for the content created inside this container.
filterDelayedEmailSubscribers(array $subscriptions)
When a user has both 'email' and 'delayed_email' subscription remove the delayed email as it would be...
unmuteNotifications(int $user_guid, int $target_guid)
No longer nute notifications about events affecting the target.
getSubscriptionRelationshipName(string $method, ?string $type=null, ?string $subtype=null, ?string $action=null)
filterSubscriptions(array $subscriptions, NotificationEvent $event, bool $filter_muted=true)
Apply filtering to subscriptions, like muted notifications etc.
$container_guid
const ELGG_ENTITIES_ANY_VALUE
Constant to request the value of a parameter be ignored in elgg_get_*() functions.
Definition: constants.php:21
const ELGG_VALUE_STRING
Definition: constants.php:112
const ELGG_VALUE_GUID
Definition: constants.php:113
const ACCESS_PRIVATE
Definition: constants.php:10
foreach($recommendedExtensions as $extension) if(empty(ini_get('session.gc_probability'))||empty(ini_get('session.gc_divisor'))) $db
if($email instanceof \Elgg\Email) $object
Definition: body.php:24
if($item instanceof \ElggEntity) elseif($item instanceof \ElggRiverItem) elseif($item instanceof \ElggRelationship) elseif(is_callable([ $item, 'getType']))
Definition: item.php:48
$relationship
Elgg default relationship view.
Definition: default.php:10
_elgg_services()
Get the global service provider.
Definition: elgglib.php:347
$target_guid
Definition: groups.php:22
Notification event interface.
getActorGUID()
Get the GUID of the actor.
getAction()
Get the name of the action.
getObject()
Get the object of the event.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
Definition: entities.php:507
$user_guid
Definition: login_as.php:10
$qb
Definition: queue.php:14
elgg_get_relationships(array $options=[])
Fetch relationships or perform a calculation on them.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
Definition: robots.php:10
$methods
Definition: subscribe.php:8
$action
Definition: subscribe.php:11
if(empty($methods)) $subscriptions
$actor_guid
Definition: mute.php:19