25 if (empty($mentions)) {
30 $notified = (array)
$entity->_mentioned_usernames;
31 $entity->_mentioned_usernames = array_merge($notified, $mentions);
39 'metadata_name_value_pairs' => [
48 $preference = $user->getNotificationSettings(
'mentions');
49 $preference = array_keys(array_filter($preference));
50 if (empty($preference)) {
54 $result[$user->guid] = $preference;
58 unset(
$result[$this->event->getActorGUID()]);
67 $lan_key =
'notification:mentions:subject';
69 $lan_key =
"notification:{$this->event->getDescription()}:subject";
81 $lan_key =
'notification:mentions:body';
83 $lan_key =
"notification:{$this->event->getDescription()}:body";
120 return [
'description'];
137 foreach ($metadata_fields as
$field) {
148 if (empty($text) || !is_string($text)) {
157 $text_mentions = array_values(array_unique(array_filter($text_mentions)));
159 $text_mentions = array_map(
function($mention) {
160 return rtrim($mention,
'.');
169 $text_mentions = (array)
_elgg_services()->events->triggerResults(
'usernames',
'mentions', $params, $text_mentions);
194 $already_notified = (array)
$entity->_mentioned_usernames;
196 return array_diff($mentions, $already_notified);
static isConfigurableForGroup(\ElggGroup $group)
{}
if(!elgg_get_config('trash_enabled')) $group
static isConfigurableForUser(\ElggUser $user)
{}
if(empty($user_guids)) $users
Mentions notification handler.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
getEventEntity()
Get the entity from the notification event.
getNotificationBody(\ElggUser $recipient, string $method)
{}
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Notification Event Handler handles preparation of a notification.
elgg_language_key_exists(string $key, string $language= 'en')
Check if a given language key exists.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
if(!$annotation instanceof ElggAnnotation) if(!$annotation->canEdit()) if(!$annotation->delete()) $lan_key
getMetadataFields()
Get the metadata fields to check for mentions.
getEventActor()
Get the acting user from the notification event.
getNotificationSubject(\ElggUser $recipient, string $method)
{}
getMentions()
Get usernames which are mentioned in the configured metadata fields.
_elgg_services()
Get the global service provider.
filterMentions(array $mentions)
Filter mentions.