You are here

function heartbeat_event_messages in Heartbeat 6.2

Fetches the translatable message for corresponding action

Parameters

string $event:

3 calls to heartbeat_event_messages()
friendlist_activity_default in user_activity/modules/friendlist_activity/friendlist_activity.rules_defaults.inc
Function to work with rules defined in friendlist
user_activity_comment_defaults in user_activity/user_activity.rules_defaults.inc
Function to work with comment events
user_activity_node_defaults in user_activity/user_activity.rules_defaults.inc
Function to work with rules on node events

File

./heartbeat.module, line 395
To fully understand this, you have to be familiar with the rules module. Lots of documentation can be found on http://drupal.org/node/298480 for an introduction and tutorial, but http://drupal.org/node/298486 is a lot of handy info for developers.

Code

function heartbeat_event_messages($event, $field) {
  static $messages;

  // If the one asked does not exist, fetch them all
  if (!isset($messages[$event])) {

    // They were fetched, but this seems to be a new one
    if (count($messages) > 0) {
      $result = db_query("SELECT event, message, message_concat, variables from {heartbeat_messages} WHERE event = '%s' LIMIT 1", $event);
    }
    else {
      $result = db_query("SELECT event, message, message_concat, variables from {heartbeat_messages}");
    }
    while ($message = db_fetch_object($result)) {
      $messages[$message->event] = $message;
    }
  }
  return $messages[$event]->{$field};
}