You are here

function messaging_devel_user_page in Messaging 7

Menu callback. Display pending messages to the user

Sample Implementation of messaging pull methods

1 string reference to 'messaging_devel_user_page'
messaging_devel_menu in messaging_devel/messaging_devel.module
Implementation of hook_menu().

File

messaging_devel/messaging_devel.module, line 100
Simple messaging using html page. Messaging method plug-in

Code

function messaging_devel_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;
}