You are here

function heartbeat_messages in Heartbeat 6.2

Same name and namespace in other branches
  1. 6.4 heartbeat.module \heartbeat_messages()
  2. 6.3 heartbeat.module \heartbeat_messages()

Theme function to help

Parameters

string $module:

boolean $reset:

boolean $objects:

Return value

array messages

2 calls to heartbeat_messages()
heartbeat_gather_messages in ./heartbeat.module
Function that gathers all messages from all modules New ones and existing ones
heartbeat_messages_overview in ./heartbeat.admin.inc
Overview list of heartbeat messages This page must be viewed to make the messages appear in the database after a module is installed as well as make them translatable

File

./heartbeat.module, line 361
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_messages($module = 'all', $reset = false, $objects = true) {
  static $messages;
  if (empty($messages) || $reset == true) {
    $messages = array();
    if ($module == 'all') {
      $result = db_query("SELECT * FROM {heartbeat_messages}");
    }
    else {
      $result = db_query("SELECT * FROM {heartbeat_messages} WHERE module = '%s'", $module);
    }
    while ($row = db_fetch_array($result)) {
      if ($objects) {
        $messages[] = new user_activity($row);
      }
      else {
        $messages[] = $row;
      }
    }
  }
  return $messages;
}