You are here

function messaging_simple_get_messages in Messaging 7

Same name and namespace in other branches
  1. 6.4 messaging_simple/messaging_simple.module \messaging_simple_get_messages()
  2. 6.3 messaging_simple/messaging_simple.module \messaging_simple_get_messages()

Get messages for user or destination

Parameters

$params: Array of integer parameters

Return value

array() Array of message objects that meet the criteria

1 call to messaging_simple_get_messages()
messaging_simple_user_overview in messaging_simple/messaging_simple.module
Display message overview list

File

messaging_simple/messaging_simple.module, line 170
Simple messaging using html page. Messaging method plug-in

Code

function messaging_simple_get_messages($params, $pager = MESSAGING_SIMPLE_PAGER) {
  $query = db_select('messaging_simple', 'm')
    ->fields('m');
  foreach ($params as $field => $value) {
    $query
      ->condition($field, (int) $value);
  }
  $query
    ->orderBy('sent', 'DESC');
  if ($pager) {
    $query
      ->extend('PagerDefault')
      ->limit($pager);
  }
  return $query
    ->execute()
    ->fetchAll();
}