function notifications_lite_add_to_queue in Notifications 6.4
Same name and namespace in other branches
- 5 notifications_lite/notifications_lite.module \notifications_lite_add_to_queue()
- 6 notifications_lite/notifications_lite.module \notifications_lite_add_to_queue()
- 6.2 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,
),
'queue' => FALSE,
// Do not send to notifications queue, save some queries
'counter' => 1,
// There will be just one queued row for this event
'objects' => array(),
);
$event['params']['text'] = array(
'subject' => $subject,
'main' => $body,
);
$event['params']['text']['digest'] = $body ? $subject . ': ' . $body : $subject;
$event['params'] = array_merge($event['params'], $params);
// Build event and store row in notifications queue and for immediate sending
$event = Notifications_Event::create($event);
notifications_lite_queue_event($event);
}