summaryrefslogtreecommitdiff
path: root/modules/contact
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-02-18 18:50:11 +0000
committerDries Buytaert <dries@buytaert.net>2005-02-18 18:50:11 +0000
commit9e8d74b49005f9f4d032cfcf528271ed736b398a (patch)
treeeeeadf76a2e3b512d827a2f702bd4561279bed3a /modules/contact
parent4f79fafb3c3d0139b0fc584f10074df8e5cb7cb2 (diff)
downloadbrdo-9e8d74b49005f9f4d032cfcf528271ed736b398a.tar.gz
brdo-9e8d74b49005f9f4d032cfcf528271ed736b398a.tar.bz2
- Patch #16590 by kbahey: usability improvement: add 'subject' form to contact form.
Diffstat (limited to 'modules/contact')
-rw-r--r--modules/contact/contact.module13
1 files changed, 11 insertions, 2 deletions
diff --git a/modules/contact/contact.module b/modules/contact/contact.module
index 188959249..3123a7fff 100644
--- a/modules/contact/contact.module
+++ b/modules/contact/contact.module
@@ -74,6 +74,9 @@ function contact_mail_user() {
if (!$edit['message']) {
form_set_error('message', t('You must enter a message.'));
}
+ if (!$edit['subject']) {
+ form_set_error('subject', t('You must enter a subject.'));
+ }
if (!form_get_errors()) {
// Compose the body:
@@ -86,13 +89,18 @@ function contact_mail_user() {
// Tidy up the body:
foreach ($message as $key => $value) {
$message[$key] = wordwrap(strip_tags($value));
+
}
// Prepare all fields:
$to = $account->mail;
$from = $user->mail;
- $subject = '['. variable_get('site_name', 'drupal') .'] '. t('message from %name', array('%name' => $user->name));
- $body = implode("\n\n", $message);
+
+ // Format the subject:
+ $subject = '['. variable_get('site_name', 'drupal') .'] '. $edit['subject'];
+
+ // Prepare the body:
+ $body = implode("\n\n", $message);
// Send the e-mail:
user_mail($to, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
@@ -114,6 +122,7 @@ function contact_mail_user() {
$output = form_item(t('From'), $user->name .' &lt;'. $user->mail .'&gt;');
$output .= form_item(t('To'), $account->name);
+ $output .= form_textfield(t('Subject'), 'subject', $edit['subject'], 50, 8, NULL, NULL, TRUE);
$output .= form_textarea(t('Message'), 'message', $edit['message'], 70, 8, NULL, NULL, TRUE);
$output .= form_submit(t('Send e-mail'));
$output = form($output);