function privatemsg_form_reply in Privatemsg 7.2
Same name and namespace in other branches
- 6.2 privatemsg.pages.inc \privatemsg_form_reply()
Form builder function; Write a reply to a thread.
1 string reference to 'privatemsg_form_reply'
- privatemsg_view in ./
privatemsg.pages.inc - Menu callback for viewing a thread.
File
- ./
privatemsg.pages.inc, line 388 - User menu callbacks for Privatemsg.
Code
function privatemsg_form_reply($form, &$form_state, $thread) {
$form = array(
'#access' => privatemsg_user_access('write privatemsg') || privatemsg_user_access('reply only privatemsg'),
);
$to = _privatemsg_get_allowed_recipients($thread['participants'], $thread['thread_id']);
if (empty($to)) {
// Display a message if some users are blocked.
// @todo: Move this check out of the form, don't use the form in that case.
$blocked_messages =& drupal_static('privatemsg_blocked_messages', array());
if (count($blocked_messages)) {
$blocked = t('You can not reply to this conversation because all recipients are blocked.');
$blocked .= theme('item_list', array(
'items' => $blocked_messages,
));
$form['blocked']['#markup'] = $blocked;
}
else {
$form['#access'] = FALSE;
}
return $form;
}
$form += _privatemsg_form_base_fields($form, $form_state);
$form['actions']['cancel'] = array(
'#value' => l(t('Clear'), $_GET['q'], array(
'attributes' => array(
'id' => 'edit-cancel',
),
)),
'#weight' => 20,
);
// Include the mid of the message we're responding to so we can mark it as
// replied when the form is submitted.
$reply_to_mid = end($thread['messages'])->mid;
$form['reply_to_mid'] = array(
'#type' => 'value',
'#value' => $reply_to_mid,
);
$form['thread_id'] = array(
'#type' => 'value',
'#value' => $thread['thread_id'],
);
$form['subject'] = array(
'#type' => 'value',
'#default_value' => $thread['subject'],
);
$form['reply'] = array(
'#markup' => '<h2 class="privatemsg-reply">' . t('Reply') . '</h2>',
'#weight' => -10,
);
$form['read_all'] = array(
'#type' => 'value',
'#value' => $thread['read_all'],
);
return $form;
}