You are here

function heartbeat_message_insert in Heartbeat 6.4

Inserts a heartbeat message

5 calls to heartbeat_message_insert()
heartbeat_create_messages in ./heartbeat.install
Initial insert of messages, before heartbeat exists in drupal as module Assumption made here that heartbeat is already included as file
heartbeat_messages_add_submit in ./heartbeat.admin.inc
Accept the form submission to add messages.
heartbeat_messages_import_submit in ./heartbeat.admin.inc
Import for heartbeat message templates().
heartbeat_messages_install in ./heartbeat.module
Function to install default records
_heartbeat_messages_rebuild in ./heartbeat.module
Rebuild the messages and check their status

File

./heartbeat.module, line 1396

Code

function heartbeat_message_insert($record) {
  $record = _heartbeat_message_prepare($record);
  $result = db_query("INSERT INTO {heartbeat_messages} (\n    message_id, message, message_concat, attachments,\n    concat_args, perms, custom, description, variables)\n    VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s') ", $record->message_id, $record->message, $record->message_concat, $record->attachments, $record->concat_args, $record->perms, $record->custom, $record->description, $record->variables);
  $last_id = db_last_insert_id('heartbeat_messages', 'hid');
  if (isset($record->tags) && $result && $last_id) {
    heartbeat_edit_tags($last_id, $record->tags);
  }

  // Add an entry to the watchdog log.
  watchdog('heartbeat', 'Heartbeat: message template %uaid added.', array(
    '%uaid' => $last_id,
  ), WATCHDOG_NOTICE, l(t('view'), 'heartbeat/message/' . $last_id, array(
    'fragment' => 'heartbeat-message-' . $last_id,
  )));
  return $result;
}