You are here

function message_instance_load_multiple in Message 6

Load multiple message instances.

Parameters

$iids: Array with message instances ids.

Return value

Array with the message instances object.

2 calls to message_instance_load_multiple()
message_instance_load in ./message.module
Message instance load.
message_views_pre_render in ./message.module
Implementation of hook_views_pre_render().

File

./message.module, line 361
API functions to manipulate messages.

Code

function message_instance_load_multiple($ids = array()) {
  $message_instances =& ctools_static(__FUNCTION__, array());

  // The ids we need to query, as some might have been cached already.
  $query_ids = array_diff($ids, array_keys($message_instances));
  if (!empty($query_ids)) {
    $placeholders = db_placeholders($query_ids);
    $result = db_query("SELECT * FROM {message_instance} WHERE iid IN ({$placeholders})", $query_ids);
    while ($row = db_fetch_object($result)) {

      // Unserialize the arguments.
      if (!empty($row->arguments)) {
        $row->arguments = unserialize($row->arguments);
      }
      $message_instances[$row->iid] = $row;
    }

    // Allow other modules to alter the message instances.
    drupal_alter('message_instances', $message_instances);
  }
  return $message_instances;
}