function feedback_mail_form_submit in Feedback 5
Process the site-wide form submission.
File
- ./
feedback.module, line 417 - Enables a site-wide feedback page.
Code
function feedback_mail_form_submit($form_id, &$edit) {
// Prepare the sender:
$from = feedback_plain_text($edit['mail']);
$page = $edit['page'];
// Compose the body:
if ($page->field_category) {
$message[] = t('Category') . ': ' . check_plain($edit['category']);
}
if ($page->field_body) {
$message[] = feedback_plain_text($edit['body']);
}
$message[] = t('Sent from @form by @name.', array(
'@name' => $edit['emailname'],
'@form' => url($_GET['q'], NULL, NULL, TRUE),
));
$message[] = _feedback_user_info($edit, $page);
// Tidy up the body:
foreach ($message as $key => $value) {
$message[$key] = wordwrap($value);
}
// Prepare the body:
$body = implode("\n\n", $message);
$category = $page->field_category ? ' [' . $edit['category'] . '] ' : ' ';
$subject = $page->subject_prefix . $category . $edit['subject'];
// Send the e-mail to the recipients:
drupal_mail('feedback', $page->email, $subject, $body, $from);
// Log the operation:
flood_register_event('feedback' . $page->name);
if ($page->logging) {
watchdog('mail', t('@name-from sent a feedback e-mail', array(
'@name-from' => $edit['emailname'] . " <{$from}>",
)));
}
// Update user:
drupal_set_message(t('Your message has been sent.'));
// Jump to home page rather than back to feedback page to avoid contradictory messages if flood control has been activated.
drupal_goto();
}