You are here

function messaging_simple_user_overview in Messaging 6.2

Same name and namespace in other branches
  1. 5 messaging_simple/messaging_simple.module \messaging_simple_user_overview()
  2. 6.4 messaging_simple/messaging_simple.module \messaging_simple_user_overview()
  3. 6 messaging_simple/messaging_simple.module \messaging_simple_user_overview()
  4. 6.3 messaging_simple/messaging_simple.module \messaging_simple_user_overview()
  5. 7 messaging_simple/messaging_simple.module \messaging_simple_user_overview()

Display message overview list

1 call to messaging_simple_user_overview()
messaging_simple_user_page in messaging_simple/messaging_simple.module
Menu callback. Display pending messages to the user

File

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

Code

function messaging_simple_user_overview($account) {
  $output = '';
  $messages = messaging_store('get', array(
    'method' => 'simple',
    'uid' => $account->uid,
  ), array(
    'mqid DESC',
  ), MESSAGING_SIMPLE_PAGER, 0, TRUE);
  if ($messages) {
    $header = array(
      t('Subject'),
      t('From'),
      t('Date'),
    );
    $rows = array();
    foreach ($messages as $message) {
      $message = (array) $message;
      $rows[] = array(
        l($message['subject'], 'user/' . $account->uid . '/messages/view/' . $message['mqid']),
        !empty($message['sender_account']) ? theme('username', $message['sender_account']) : t('System'),
        format_date($message['created']),
      );
    }
    $output .= theme('table', $header, $rows);
    $output .= theme('pager', array(), MESSAGING_SIMPLE_PAGER);
  }
  else {
    $output .= '<p class="message-queue-empty">' . t('No pending messages') . '</p>';
  }
  return $output;
}