92 foreach ($records as $record) {
93 if (empty($record->guid)) {
102 $deliveryMethods = explode(
',', $record->methods);
140 foreach ($records as $record) {
141 if (empty($record->guid)) {
150 $deliveryMethods = explode(
',', $record->methods);
183 if (!
_elgg_services()->notifications->isRegisteredMethod($method)) {
235 return $this->relationshipsTable->check(
$user_guid, implode(
':', $rel),
$target_guid) instanceof \ElggRelationship;
260 $select->select(
'count(*) as total')
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);
270 $select->andWhere($select->merge($ors,
'OR'));
272 $result = $this->db->getDataRow($select);
294 self::RELATIONSHIP_PREFIX,
340 return (
bool) $this->db->deleteData(
$delete);
356 $rel =
$qb->joinRelationshipTable($main_alias,
'guid',
null,
true);
361 $rel =
$qb->joinRelationshipTable($main_alias,
'guid',
null,
true);
364 return $qb->compare(
"{$rel}.relationship",
'like', self::RELATIONSHIP_PREFIX .
':%',
ELGG_VALUE_STRING);
369 $ors[] =
$qb->compare(
"{$rel}.relationship",
'=', self::RELATIONSHIP_PREFIX .
':' . $method,
ELGG_VALUE_STRING);
370 $ors[] =
$qb->compare(
"{$rel}.relationship",
'like', self::RELATIONSHIP_PREFIX .
':%:' . $method,
ELGG_VALUE_STRING);
373 return $qb->merge($ors,
'OR');
422 return $qb->compare(
"{$main_alias}.relationship",
'like', self::RELATIONSHIP_PREFIX .
':%',
ELGG_VALUE_STRING);
430 $ors[] =
$qb->compare(
"{$main_alias}.relationship",
'=', self::RELATIONSHIP_PREFIX .
':' . $method,
ELGG_VALUE_STRING);
431 $ors[] =
$qb->compare(
"{$main_alias}.relationship",
'like', self::RELATIONSHIP_PREFIX .
':%:' . $method,
ELGG_VALUE_STRING);
434 return $qb->merge($ors,
'OR');
442 return $qb->compare(
"{$main_alias}.relationship",
'like', self::RELATIONSHIP_PREFIX .
":{$type}:{$subtype}:{$action}:%",
ELGG_VALUE_STRING);
460 $rel = new \ElggRelationship();
462 $rel->relationship = self::MUTE_NOTIFICATIONS_RELATIONSHIP;
505 return array_values(array_filter(array_unique($user_methods)));
533 $guids_to_check = [];
548 $guids_to_check[] =
$entity->guid;
549 $guids_to_check[] =
$entity->owner_guid;
550 $guids_to_check[] =
$entity->container_guid;
554 $guids_to_check = array_filter($guids_to_check);
555 if (empty($guids_to_check)) {
560 $select = Select::fromTable(RelationshipsTable::TABLE_NAME);
561 $select->select(
'guid_one')
562 ->where($select->compare(
'relationship',
'=', self::MUTE_NOTIFICATIONS_RELATIONSHIP,
ELGG_VALUE_STRING))
563 ->andWhere($select->compare(
'guid_two',
'in', $guids_to_check,
ELGG_VALUE_GUID));
565 $muted = $this->db->getData($select,
function($row) {
566 return (
int) $row->guid_one;
581 return array_map(function ($user_methods) {
582 if (!in_array(
'delayed_email', $user_methods) || !in_array(
'email', $user_methods)) {
583 return $user_methods;
586 $pos = array_search(
'delayed_email', $user_methods);
587 unset($user_methods[$pos]);
589 return array_values($user_methods);
605 'callback' => function ($row) {
606 return (
int) $row->guid;
608 'metadata_name_value_pairs' => [
610 'name' =>
'timed_muting_start',
615 'name' =>
'timed_muting_end',
652 $select = Select::fromTable(RelationshipsTable::TABLE_NAME);
653 $select->select(
'guid_one AS guid')
654 ->addSelect(
"GROUP_CONCAT(relationship SEPARATOR ',') AS methods")
657 ->groupBy(
'guid_one');
663 return $this->db->getData($select);
677 $prefix = self::RELATIONSHIP_PREFIX;
681 $names[] =
"{$prefix}:{$method}";
684 $names[] =
"{$prefix}:{$type}:{$subtype}:{$action}:{$method}";
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/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['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'], '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'=>[],]
$guids
Activates all specified installed and inactive plugins.
A generic class that contains shared code among \ElggExtender, \ElggEntity, and \ElggRelationship.
Query builder for updating data in the database.
Entities repository contains methods for fetching entities from database or performing calculations o...
Database abstraction query builder.
Relationships table database service.
Query builder for fetching data from the database.
static fromTable(string $table, ?string $alias=null)
Returns a QueryBuilder for selecting data from a given table.
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.
const RELATIONSHIP_PREFIX
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.
const MUTE_NOTIFICATIONS_RELATIONSHIP
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.
filterSubscriptions(array $subscriptions, NotificationEvent $event, bool $filter_muted=true)
Apply filtering to subscriptions, like muted notifications etc.
const ELGG_ENTITIES_ANY_VALUE
Constant to request the value of a parameter be ignored in elgg_get_*() functions.
foreach($recommendedExtensions as $extension) if(empty(ini_get('session.gc_probability'))||empty(ini_get('session.gc_divisor'))) $db
if($email instanceof \Elgg\Email) $object
if($item instanceof \ElggEntity) elseif($item instanceof \ElggRiverItem) elseif($item instanceof \ElggRelationship) elseif(is_callable([ $item, 'getType']))
$relationship
Elgg default relationship view.
_elgg_services()
Get the global service provider.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
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_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.
if(empty($methods)) $subscriptions