Elgg  Version 6.3
Functions
notification.php File Reference

Go to the source code of this file.

Functions

 elgg_register_notification_event (string $object_type, string $object_subtype, array $actions=[], string $handler=NotificationEventHandler::class)
 Register a notification event. More...
 
 elgg_unregister_notification_event (string $object_type, string $object_subtype, array $actions=[])
 Unregister a notification event. More...
 
 elgg_register_notification_method (string $name)
 Register a delivery method for notifications. More...
 
 elgg_get_notification_methods ()
 Returns registered delivery methods for notifications [ 'email' => 'email', 'sms' => 'sms', ] More...
 
 elgg_unregister_notification_method (string $name)
 Unregister a delivery method for notifications. More...
 
 elgg_get_notification_events ()
 Get the registered notification events in the format. More...
 
 elgg_get_subscriptions_for_container (int $container_guid)
 Get the subscriptions for the content created inside this container. More...
 
 elgg_send_email (\Elgg\Email $email)
 Send an email to any email address. More...
 
 elgg_enqueue_notification_event (string $action, \ElggData $object, ?\ElggEntity $actor=null)
 Enqueue a notification event for delivery. More...
 
 elgg_notify_user (\ElggUser $recipient, string $action, \ElggData $subject, array $params=[], ?\ElggEntity $from=null)
 Notify a user about a given action on a subject. More...
 

Function Documentation

◆ elgg_enqueue_notification_event()

elgg_enqueue_notification_event ( string  $action,
\ElggData  $object,
?\ElggEntity  $actor = null 
)

Enqueue a notification event for delivery.

Only use this function if the default event based queueing can't be used.

Parameters
string$actionthe action of the notification event
\ElggData$objectthe object used in the notification event
null | \ElggEntity$actor(optional) the actor of the notification event (default: logged-in user or owner of $object)
See also
elgg_register_notification_event()
Returns
void
Since
4.3

Definition at line 202 of file notification.php.

◆ elgg_get_notification_events()

elgg_get_notification_events ( )

Get the registered notification events in the format.

array ( <type> => array ( <subtype> => array ( <action1>, <action2>, ) ) )

Returns
array
Since
4.0

Definition at line 153 of file notification.php.

◆ elgg_get_notification_methods()

elgg_get_notification_methods ( )

Returns registered delivery methods for notifications [ 'email' => 'email', 'sms' => 'sms', ]

Returns
array
Since
2.3

Definition at line 121 of file notification.php.

◆ elgg_get_subscriptions_for_container()

elgg_get_subscriptions_for_container ( int  $container_guid)

Get the subscriptions for the content created inside this container.

The return array is of the form:

array( <user guid> => array('email', 'sms', 'ajax'), );

Parameters
int$container_guidGUID of the entity acting as a container
Returns
array User GUIDs (keys) and their subscription types (values).
Since
1.9

Definition at line 171 of file notification.php.

◆ elgg_notify_user()

elgg_notify_user ( \ElggUser  $recipient,
string  $action,
\ElggData  $subject,
array  $params = [],
?\ElggEntity  $from = null 
)

Notify a user about a given action on a subject.

Parameters
\ElggUser$recipientThe recipient user
string$actionThe action on $subject
\ElggData$subjectThe notification subject
array$paramsAdditional params use $params['methods_override'] to override the recipient notification methods (eg 'email' or 'site')
null | \ElggEntity$fromSender of the message
Returns
array Compound array of each delivery user/delivery method's success or failure.
Since
6.3

Definition at line 219 of file notification.php.

◆ elgg_register_notification_event()

elgg_register_notification_event ( string  $object_type,
string  $object_subtype,
array  $actions = [],
string  $handler = NotificationEventHandler::class 
)

Register a notification event.

Elgg sends notifications for the items that have been registered with this function. For example, if you want notifications to be sent when a bookmark has been created or updated, call the function like this:

   elgg_register_notification_event('object', 'bookmarks', array('create', 'update'));
Parameters
string$object_type'object', 'user', 'group', 'site'
string$object_subtypeThe subtype or name of the entity
array$actionsArray of actions or empty array for the action event. An event is usually described by the first string passed to elgg_trigger_event(). Examples include 'create', 'update', and 'publish'. The default is 'create'.
string$handlerNotificationEventHandler classname
Returns
void
Since
1.9

Definition at line 73 of file notification.php.

◆ elgg_register_notification_method()

elgg_register_notification_method ( string  $name)

Register a delivery method for notifications.

Register for the 'send', 'notification:[method name]' event to handle sending a notification. A notification object is in the params array for the event with the key 'notification'. See \Elgg\Notifications\Notification.

Parameters
string$nameThe notification method name
Returns
void
See also
elgg_unregister_notification_method()
Since
1.9

Definition at line 105 of file notification.php.

◆ elgg_send_email()

elgg_send_email ( \Elgg\Email  $email)

Send an email to any email address.

Parameters
\Elgg\Email$emailEmail
Returns
bool
Since
1.7.2

Definition at line 185 of file notification.php.

◆ elgg_unregister_notification_event()

elgg_unregister_notification_event ( string  $object_type,
string  $object_subtype,
array  $actions = [] 
)

Unregister a notification event.

Parameters
string$object_type'object', 'user', 'group', 'site'
string$object_subtypeThe type of the entity
array$actionsThe notification action to unregister, leave empty for all actions. Example ('create', 'delete', 'publish')
Returns
void
Since
1.9
See also
elgg_register_notification_event()

Definition at line 88 of file notification.php.

◆ elgg_unregister_notification_method()

elgg_unregister_notification_method ( string  $name)

Unregister a delivery method for notifications.

Parameters
string$nameThe notification method name
Returns
void
See also
elgg_register_notification_method()
Since
1.9

Definition at line 134 of file notification.php.