Elgg  Version 1.9
Namespaces | Functions
notification.php File Reference

Go to the source code of this file.

Namespaces

 Elgg\Core
 Activate a plugin or plugins.
 

Functions

 elgg_register_notification_event ($object_type, $object_subtype, array $actions=array())
 Register a notification event. More...
 
 elgg_unregister_notification_event ($object_type, $object_subtype)
 Unregister a notification event. More...
 
 elgg_register_notification_method ($name)
 Register a delivery method for notifications. More...
 
 elgg_unregister_notification_method ($name)
 Unregister a delivery method for notifications. More...
 
 elgg_add_subscription ($user_guid, $method, $target_guid)
 Subscribe a user to notifications about a target entity. More...
 
 elgg_remove_subscription ($user_guid, $method, $target_guid)
 Unsubscribe a user to notifications about a target entity. More...
 
 elgg_get_subscriptions_for_container ($container_guid)
 Get the subscriptions for the content created inside this container. More...
 
 _elgg_enqueue_notification_event ($action, $type, $object)
 Queue a notification event for later handling. More...
 
 _elgg_notifications_cron ()
 private More...
 
 _elgg_send_email_notification ($hook, $type, $result, $params)
 Send an email notification. More...
 
 _elgg_notifications_init ()
 private More...
 
 _elgg_notify_user ($to, $from, $subject, $message, array $params=null, $methods_override="")
 Notify a user via their preferences. More...
 
 notify_user ($to, $from, $subject, $message, array $params=array(), $methods_override="")
 Notify a user via their preferences. More...
 
 get_user_notification_settings ($user_guid=0)
 Get the notification settings for a given user. More...
 
 set_user_notification_setting ($user_guid, $method, $value)
 Set a user notification pref. More...
 
 elgg_send_email ($from, $to, $subject, $body, array $params=null)
 Send an email to any email address. More...
 
 _elgg_save_notification_user_settings ()
 Save personal notification settings - input comes from request. More...
 
 _elgg_notifications_test ($hook, $type, $tests)
 private More...
 

Function Documentation

_elgg_enqueue_notification_event (   $action,
  $type,
  $object 
)

Queue a notification event for later handling.

Checks to see if this event has been registered for notifications. If so, it adds the event to a notification queue.

This function triggers the 'enqueue', 'notification' hook.

Parameters
string$actionThe name of the action
string$typeThe type of the object
ElggData$objectThe object of the event
Returns
void private
Since
1.9

Definition at line 171 of file notification.php.

_elgg_notifications_cron ( )

private

Definition at line 178 of file notification.php.

_elgg_notifications_init ( )

private

Definition at line 281 of file notification.php.

_elgg_notifications_test (   $hook,
  $type,
  $tests 
)

private

Definition at line 719 of file notification.php.

_elgg_notify_user (   $to,
  $from,
  $subject,
  $message,
array  $params = null,
  $methods_override = "" 
)

Notify a user via their preferences.

Parameters
mixed$toEither a guid or an array of guid's to notify.
int$fromGUID of the sender, which may be a user, site or object.
string$subjectMessage subject.
string$messageMessage body.
array$paramsMisc additional parameters specific to various methods.
mixed$methods_overrideA string, or an array of strings specifying the delivery methods to use - or leave blank for delivery using the user's chosen delivery methods.
Returns
array Compound array of each delivery user/delivery method's success or failure. private

Definition at line 314 of file notification.php.

_elgg_save_notification_user_settings ( )

Save personal notification settings - input comes from request.

Returns
void private

Definition at line 692 of file notification.php.

_elgg_send_email_notification (   $hook,
  $type,
  $result,
  $params 
)

Send an email notification.

Parameters
string$hookHook name
string$typeHook type
bool$resultHas anyone sent a message yet?
array$paramsHook parameters
Returns
bool private

Definition at line 195 of file notification.php.

elgg_add_subscription (   $user_guid,
  $method,
  $target_guid 
)

Subscribe a user to notifications about a target entity.

Parameters
int$user_guidThe GUID of the user to subscribe to notifications
string$methodThe delivery method of the notifications
int$target_guidThe entity to receive notifications about
Returns
bool
Since
1.9

Definition at line 112 of file notification.php.

elgg_get_subscriptions_for_container (   $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 149 of file notification.php.

elgg_register_notification_event (   $object_type,
  $object_subtype,
array  $actions = array() 
)

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'.
Returns
void
Since
1.9

Definition at line 59 of file notification.php.

elgg_register_notification_method (   $name)

Register a delivery method for notifications.

Register for the 'send', 'notification:[method name]' plugin hook to handle sending a notification. A notification object is in the params array for the hook 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 87 of file notification.php.

elgg_remove_subscription (   $user_guid,
  $method,
  $target_guid 
)

Unsubscribe a user to notifications about a target entity.

Parameters
int$user_guidThe GUID of the user to unsubscribe to notifications
string$methodThe delivery method of the notifications to stop
int$target_guidThe entity to stop receiving notifications about
Returns
bool
Since
1.9

Definition at line 128 of file notification.php.

elgg_send_email (   $from,
  $to,
  $subject,
  $body,
array  $params = null 
)

Send an email to any email address.

Parameters
string$fromEmail address or string: "name <email>"
string$toEmail address or string: "name <email>"
string$subjectThe subject of the message
string$bodyThe message body
array$paramsOptional parameters (none used in this function)
Returns
bool
Exceptions
NotificationException
Since
1.7.2

Definition at line 595 of file notification.php.

elgg_unregister_notification_event (   $object_type,
  $object_subtype 
)

Unregister a notification event.

Parameters
string$object_type'object', 'user', 'group', 'site'
string$object_subtypeThe type of the entity
Returns
bool
Since
1.9

Definition at line 71 of file notification.php.

elgg_unregister_notification_method (   $name)

Unregister a delivery method for notifications.

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

Definition at line 99 of file notification.php.

get_user_notification_settings (   $user_guid = 0)

Get the notification settings for a given user.

Parameters
int$user_guidThe user id
Returns
stdClass|false

Definition at line 521 of file notification.php.

notify_user (   $to,
  $from,
  $subject,
  $message,
array  $params = array(),
  $methods_override = "" 
)

Notify a user via their preferences.

Parameters
mixed$toEither a guid or an array of guid's to notify.
int$fromGUID of the sender, which may be a user, site or object.
string$subjectMessage subject.
string$messageMessage body.
array$paramsMisc additional parameters specific to various methods.
                            By default Elgg core supports three parameters, which give
                            notification plugins more control over the notifications:

                            object => null|ElggEntity|ElggAnnotation The object that
                                      is triggering the notification.

                            action => null|string Word that describes the action that
                                      is triggering the notification (e.g. "create"
                                      or "update").

                            summary => null|string Summary that notification plugins
                                       can use alongside the notification title and body.
mixed$methods_overrideA string, or an array of strings specifying the delivery methods to use - or leave blank for delivery using the user's chosen delivery methods.
Returns
array Compound array of each delivery user/delivery method's success or failure.
Exceptions
NotificationException

Definition at line 436 of file notification.php.

set_user_notification_setting (   $user_guid,
  $method,
  $value 
)

Set a user notification pref.

Parameters
int$user_guidThe user id.
string$methodThe delivery method (eg. email)
bool$valueOn(true) or off(false).
Returns
bool

Definition at line 562 of file notification.php.