function notifications_lite_add_to_queue in Notifications 6.2
Same name and namespace in other branches
- 5 notifications_lite/notifications_lite.module \notifications_lite_add_to_queue()
- 6.4 notifications_lite/notifications_lite.module \notifications_lite_add_to_queue()
- 6 notifications_lite/notifications_lite.module \notifications_lite_add_to_queue()
Put simple notification into queue
Parameters
$uid: User id for destination
$subject: Notification subject
$body: Optional notification body
$action: Optional action name, so other modules can define specific message parts for their actions If so, they must define event types too
1 call to notifications_lite_add_to_queue()
- notifications_lite_send in notifications_lite/
notifications_lite.module - Sends out a notification for a user
File
- notifications_lite/
notifications_lite.module, line 83 - Simple notifications API
Code
function notifications_lite_add_to_queue($uid, $subject, $body = '', $action = 'default', $params = array()) {
// Build and store simple event
$event = array(
'module' => 'notifications',
'uid' => 0,
'oid' => $uid,
'type' => 'lite',
'action' => $action,
'params' => array(
'for-uid' => $uid,
'subject' => $subject,
'body' => $body,
),
'queue' => FALSE,
// Do not send to notifications queue, save some queries
'counter' => 1,
);
$event['params'] = array_merge($event['params'], $params);
$event = notifications_event($event);
// Store row in notifications queue and for immediate sending
notifications_lite_queue_event($event);
notifications_module_invoke('event queued', $event);
notifications_send_immediate($event->eid);
}