function notifications_event in Notifications 6.2
Same name and namespace in other branches
- 5 notifications.module \notifications_event()
- 6.4 notifications.module \notifications_event()
- 6 notifications.module \notifications_event()
- 6.3 notifications.module \notifications_event()
- 7 notifications.module \notifications_event()
Process subscriptions events
Parameters
$event: Array with event parameters
3 calls to notifications_event()
- notifications_content_comment in notifications_content/
notifications_content.module - Implementation of hook_comment().
- notifications_content_nodeapi in notifications_content/
notifications_content.module - Implementation of hook_nodeapi()
- notifications_lite_add_to_queue in notifications_lite/
notifications_lite.module - Put simple notification into queue
4 string references to 'notifications_event'
- NotificationsContentTests::testNotificationsContent in tests/
notifications_content.test - Play with creating, retrieving, deleting a pair subscriptions
- NotificationsLiteTests::testNotificationsLite in tests/
notifications_lite.test - Test simple sending cases
- notifications_event_tracker in ./
notifications.cron.inc - Keep track of events and update event counter with processed rows eids
- notifications_update_6002 in ./
notifications.install - Add some fields
File
- ./
notifications.module, line 385 - Notifications module
Code
function notifications_event($event) {
global $user;
// Fill in event with default values
$event += array(
'uid' => $user->uid,
'load_args' => '',
'created' => time(),
'module' => 'notifications',
// Module that triggered the event
'type' => '',
// Object/event type
'action' => '',
// Action that happened to the object
'params' => array(),
);
// Check whether we have to save and queue this event, defaults to yes if not set
// If not enabled, do not store nor queue this event, can be changed by plug-in modules
$enabled = notifications_event_enabled($event['type'], $event['action']);
$event += array(
'save' => $enabled,
'queue' => $enabled,
);
$event = (object) $event;
// Notify other modules we are about to trigger some subscriptions event
// Modules can do cleanup operations or modify event properties
notifications_module_invoke('event trigger', $event);
// Store event, unles marked not to be saved
if ($event->save) {
drupal_write_record('notifications_event', $event);
}
// Send event to queue for subscriptions, unless marked not to
if ($event->queue) {
notifications_queue($event);
}
return $event;
}