New Zenner
- Join Date:
- Jan 2007
- Location:
- Boston, MA, USA
- Posts:
- 40
- Plugin Contributions:
- 0
Help with contact_us -- customized subject field
Some things I'd like to change on the contact_us page:
-
Make it so customers cannot send a message without a subject
-
Make the subject specified by the customer the subject line of the email I receive (EMAIL_SUBJECT)
Ok, I have a subject field added to the contact_us page from this download. And I've sort of achieved #1, but not completely. I edited includes/modules/pages/contact_us/header_php.php to include the part in bold:
$error = true;
if (empty($name)) {
$messageStack->add('contact', ENTRY_EMAIL_NAME_CHECK_ERROR);
}
if ($zc_validate_email == false) {
$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
[B]if (empty($subject)) {[/B]
[B] $messageStack->add('contact', ENTRY_EMAIL_SUBJECT_CHECK_ERROR);[/B]
[B] }[/B]
if (empty($enquiry)) {
$messageStack->add('contact', ENTRY_EMAIL_CONTENT_CHECK_ERROR);
}
And I have ENTRY_EMAIL_SUBJECT_CHECK_ERROR specified in contact_us.php.
When I try to use the contact form without a subject or message, I get the appropriate error messages. But once I put in a message, I'm able to send the email. It seems it only has a problem with the empty subject field if the message field is empty too. How can I fix this?
With #2, I have tried putting this in contact_us.php, but it doesn't work:
define('EMAIL_SUBJECT', 'Message about '.$subject);
The subject is definitely defined as $subject in tpl_contact_us.php. I have even tried putting in $name and stuff like that, but it doesn't work. It seems that it doesn't want to put anything not within the single quotes into the subject line. Is there a way around this? Like is there something I can put in includes/modules/pages/contact_us/header_php.php that tells it to automatically put $subject into the email subject line?