'#maxlength' => 255,
'#default_value' => $subject,
'#weight' => -5,
- '#required' => TRUE,
);
$form['privatemsg']['body'] = array(
'#type' => 'textarea',
$message['thread_id'] = $form_state['values']['thread_id'];
}
-
+ $trimed_body = trim(truncate_utf8(strip_tags($message['body']), 50, TRUE, TRUE));
+ if (empty($message['subject']) && !empty($trimed_body)) {
+ $message['subject'] = $trimed_body;
+ }
// Verify that recipient's name syntax is correct.
$fragments = explode(',', $form_state['values']['recipient']);
$errors[] = t('Disallowed to send a message without subject');
}
- $trimmed = trim(strip_tags($message['body']));
- if (empty($trimmed)) {
- $errors[] = t('Blank messages are not allowed');
- }
-
if (empty($message['recipients']) || !is_array($message['recipients'])) {
$errors[] = t('Disallowed to send a message without atleast one recipient');
}