19 $entity = $this->
event->getObject();
26 if (empty($mentions)) {
31 $notified = (array)
$entity->_mentioned_usernames;
32 $entity->_mentioned_usernames = array_merge($notified, $mentions);
40 'metadata_name_value_pairs' => [
49 $preference = $user->getNotificationSettings(
'mentions');
50 $preference = array_keys(array_filter($preference));
51 if (empty($preference)) {
55 $result[$user->guid] = $preference;
59 unset(
$result[$this->event->getActorGUID()]);
69 $actor = $this->
event->getActor();
71 $lan_key =
'notification:mentions:subject';
73 $lan_key =
"notification:{$this->event->getDescription()}:subject";
84 $actor = $this->
event->getActor();
85 $entity = $this->
event->getObject();
87 $lan_key =
'notification:mentions:body';
89 $lan_key =
"notification:{$this->event->getDescription()}:body";
126 return [
'description'];
137 $entity = $this->
event->getObject();
140 foreach ($metadata_fields as
$field) {
151 if (empty($text) || !is_string($text)) {
160 $text_mentions = array_values(array_unique(array_filter($text_mentions)));
162 $text_mentions = array_map(
function($mention) {
163 return rtrim($mention,
'.');
172 $text_mentions = (array)
_elgg_services()->events->triggerResults(
'usernames',
'mentions', $params, $text_mentions);
193 $entity = $this->
event->getObject();
195 $already_notified = (array)
$entity->_mentioned_usernames;
197 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.
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.
getLanguage(string $fallback=null)
Get user language or default to site language.
if(!$annotation instanceof ElggAnnotation) if(!$annotation->canEdit()) if(!$annotation->delete()) $lan_key
getMetadataFields()
Get the metadata fields to check for mentions.
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.
getDisplayName()
Get the entity's display name.