You are here

private function HeartbeatActivity::log_message in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 includes/heartbeatactivity.inc \HeartbeatActivity::log_message()
  2. 7 includes/heartbeatactivity.inc \HeartbeatActivity::log_message()

Logs a heartbeat message

Parameters

string language optional:

2 calls to HeartbeatActivity::log_message()
HeartbeatActivity::save_locale in includes/heartbeatactivity.inc
Save activity log with multilingual content and multilingual parts to pre-translate
HeartbeatActivity::_save in includes/heartbeatactivity.inc
Save activity log

File

includes/heartbeatactivity.inc, line 177

Class

HeartbeatActivity
Class to handle user activity data

Code

private function log_message($args, $lang = '') {
  if ($lang == '') {
    global $language;
    $lang = $language->language;
  }

  // Mis-usage of the t-function, but how could i fix this?
  $message = t($this->m_message, $args, $lang);
  $message_concat = t($this->m_message_concat, $args, $lang);

  // Checks if there should be logging what so ever
  if (empty($message)) {
    watchdog('heartbeat', 'Error in logging user activity: it is not possible to log empty message', array(), WATCHDOG_ERROR);
    return false;
  }
  if (!is_numeric($this->m_uid) || $this->m_uid <= 0) {
    watchdog('heartbeat', 'Error in logging user activity: no information on the user invoking heartbeat activity', array(), WATCHDOG_ERROR);
    return false;
  }

  //dsm($message);

  // Log relational message to user activity
  return db_query("INSERT INTO {heartbeat_activity} SET uid=%d, uid_target=%d, nid_target=%d, message_id='%s', language='%s',\n    access = %d, message ='%s',message_concat ='%s', timestamp=%d, variables='%s'", $this->m_uid, $this->m_uid_target, $this->m_nid_target, $this->m_message_id, $lang, $this->m_access, $message, $message_concat, $_SERVER['REQUEST_TIME'], $this->m_variables_string);
}