You are here

function messaging_simple_user_message in Messaging 6

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

Display single message

1 string reference to 'messaging_simple_user_message'
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 83
Simple messaging using html page. Messaging method plug-in

Code

function messaging_simple_user_message($form_state, $account, $id) {
  $form = array();
  if ($messages = messaging_store('get', array(
    'mqid' => $id,
    'method' => 'simple',
    'uid' => $account->uid,
  ))) {
    $message = (array) array_shift($messages);
    $form['account'] = array(
      '#type' => 'value',
      '#value' => $account,
    );
    $form['message'] = array(
      '#type' => 'value',
      '#value' => $message,
    );
    $form['subject'] = array(
      '#type' => 'item',
      '#title' => t('Subject'),
      '#value' => $message['subject'],
    );
    $form['body'] = array(
      '#type' => 'item',
      '#title' => t('Content'),
      '#value' => $message['body'],
    );
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
    $form['#redirect'] = 'user/' . $account->uid . '/messages';
  }
  return $form;
}