public function MessageDigest::deliver in Message Digest 7
Deliver a message via the required transport method.
Parameters
$output: Array keyed by the view mode, and the rendered entity in the specified view mode.
Return value
TRUE or FALSE based on delivery status.
Overrides MessageNotifierBase::deliver
File
- plugins/
notifier/ abstract.inc, line 12
Class
- MessageDigest
- Message Digest notifier.
Code
public function deliver(array $output = array()) {
$message = $this->message;
$plugin = $this->plugin;
$message_digest = array(
'receiver' => $message->uid,
'gid' => !empty($message->gid) ? $message->gid : 0,
'notifier' => $plugin['name'],
'sent' => FALSE,
'timestamp' => $message->timestamp,
);
// This will only have a value if the message is not a message_subscribe message.
$mid = isset($message->mid) ? $message->mid : NULL;
// Our $message is a cloned copy of the original $message with the mid field removed to
// prevent overwriting (this happens in message_subscribe) so we need to fetch the mid manually.
if (empty($mid)) {
$mid = db_select('message', 'm')
->fields('m', array(
'mid',
))
->condition('timestamp', $message->timestamp)
->condition('type', $message->type)
->execute()
->fetchField();
}
if (!empty($mid)) {
$message_digest['mid'] = $mid;
}
drupal_write_record('message_digest', $message_digest);
return TRUE;
}