You are here

function messaging_debug_user_page in Messaging 6

Same name and namespace in other branches
  1. 5 messaging_debug/messaging_debug.module \messaging_debug_user_page()
  2. 6.2 messaging_debug/messaging_debug.module \messaging_debug_user_page()
  3. 6.3 messaging_debug/messaging_debug.module \messaging_debug_user_page()

Menu callback. Display pending messages to the user

Sample Implementation of messaging pull methods

1 string reference to 'messaging_debug_user_page'
messaging_debug_menu in messaging_debug/messaging_debug.module
Implementation of hook_menu().

File

messaging_debug/messaging_debug.module, line 154
Simple messaging using html page. Messaging method plug-in

Code

function messaging_debug_user_page($account) {
  drupal_set_title(t('Messages for %name', array(
    '%name' => $account->name,
  )));

  // Fetch all pending messages.
  $output = '';

  // Use this method's info for all the messages
  $messages = messaging_store('get', array(
    'uid' => $account->uid,
  ), array(
    'mqid DESC',
  ), MESSAGING_DEBUG_PAGER, 0);
  if ($messages) {
    $header = array(
      t('Method'),
      t('Subject'),
      t('Body'),
    );
    foreach ($messages as $message) {

      // Check plain everything so we can actually see the mark up if any
      $rows[] = array(
        $message->method,
        check_plain($message->subject),
        check_plain($message->body),
      );
    }
    $output .= theme('table', $header, $rows);
    $output .= theme('pager', array(), MESSAGING_DEBUG_PAGER);
  }
  else {
    $output .= t('No logged messages');
  }
  return $output;
}