I've been adding mods, updating, and generally mucking around in the zen code for the past two years and I have to say, "Wow, this was the most confusing change I have ever had to make!"
That said, I worked it out for both the Contact Us and the Report A Price mod. (I have not figured out the Create Account yet b/c the header file looks NOTHING like the ones in the examples, lol).
Here is what I did on the contact us form:
in /includes/templates/template_default/tpl_contact_us_default.php find:
Code:
<label class="inputLabel" for="email-address"><?php echo ENTRY_EMAIL; ?></label>
<?php echo zen_draw_input_field('email', ($email_address), ' size="40" id="email-address"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />
directly under it put this:
Code:
<!-- NOSPAM -->
<input style="visibility:hidden; display:none;" name="leaveblank" type="text">
<br class="clearBoth" />
<!-- NO SPAM -->
*** You probably should save this and upload it to YOURTEMPLATE folder as well so it won't be over-ridden with an update. ***
Then in includes/modules/pages/contact_us/header.php make the following changes:
Highlight this (around line 14):
Code:
$error = false;
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
$name = zen_db_prepare_input($_POST['contactname']);
$email_address = zen_db_prepare_input($_POST['email']);
$subject = zen_db_prepare_input($_POST['subject']);
$enquiry = zen_db_prepare_input(strip_tags($_POST['enquiry']));
$zc_validate_email = zen_validate_email($email_address);
if ($zc_validate_email and !empty($enquiry) and !empty($name)) {
and replace it with this:
Code:
$error = false;
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
$name = zen_db_prepare_input($_POST['contactname']);
$email_address = zen_db_prepare_input($_POST['email']);
$subject = zen_db_prepare_input($_POST['subject']);
// NO SPAM
$leaveblank = zen_db_prepare_input($_POST["leaveblank"]);
// NO SPAM
$enquiry = zen_db_prepare_input(strip_tags($_POST['enquiry']));
//edited for NO SPAM
$zc_validate_email = zen_validate_email($email_address);
if ($zc_validate_email and !empty($enquiry) and !empty($name) and !empty($subject) and empty($leaveblank)) {
Then find (around line 93):
Code:
if (empty($enquiry)) {
$messageStack->add('contact', ENTRY_EMAIL_CONTENT_CHECK_ERROR);
}
Directly under it add:
Code:
//NO SPAM
if (!empty($leaveblank)) {
zen_redirect(zen_href_link(FILENAME_TIME_OUT, 'action=success'));
}
//NO SPAM
Test the form normally to make sure you DO get mail from customers. Then using firefox, disable the inline CSS styles filling out all the lines including the one that should be blank. When you hit send, you should be redirected to the session timed out page. If you get blank pages or the email goes through when it shouldn't, verify all the changes for missing punctuation and check the CACHE file for errors.
For the Report A Cheaper Price mod in includes/templates/template_default/tpl_report_a_price_default.php find (about line 74):
Code:
<label class="inputLabel" for="email-address"><?php echo ENTRY_EMAIL; ?></label>
<?php echo zen_draw_input_field('email', ($error ? $_POST['email'] : $email), ' size="40" id="email-address"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />
directly under it add:
Code:
<!-- NOSPAM -->
<input style="visibility:hidden; display:none;" name="leaveblank" type="text">
<br class="clearBoth" />
<!-- NO SPAM -->
Then in includes/modules/pages/report_a_price/header.php find (about line 35):
Code:
$error = false;
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
$name = zen_db_prepare_input($_POST['contactname']);
$email_address = zen_db_prepare_input($_POST['email']);
$other_store = zen_db_prepare_input(strip_tags($_POST['other_store']));
$other_store_location = zen_db_prepare_input(strip_tags($_POST['other_store_location']));
$other_price = zen_db_prepare_input(strip_tags($_POST['other_price']));
$zc_validate_email = zen_validate_email($email_address);
if ($zc_validate_email and !empty($other_store) and !empty($other_store_location) and !empty($other_price) and !empty($name)) {
Replace with
Code:
$error = false;
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
$name = zen_db_prepare_input($_POST['contactname']);
$email_address = zen_db_prepare_input($_POST['email']);
// NO SPAM
$leaveblank = zen_db_prepare_input($_POST['leaveblank']);
// NO SPAM
$other_store = zen_db_prepare_input(strip_tags($_POST['other_store']));
$other_store_location = zen_db_prepare_input(strip_tags($_POST['other_store_location']));
$other_price = zen_db_prepare_input(strip_tags($_POST['other_price']));
$zc_validate_email = zen_validate_email($email_address);
if ($zc_validate_email and !empty($other_store) and !empty($other_store_location) and !empty($other_price) and !empty($name) and empty($leaveblank)) {
Test the form normally to make sure you DO get mail from customers. Then using firefox, disable the inline CSS styles filling out all the lines including the one that should be blank. When you hit send, you should be redirected to the session timed out page. If you get blank pages or the email goes through when it shouldn't, verify all the changes for missing punctuation and check the CACHE file for errors.
If you get a blank page after this, check for syntax errors - I had an extra } on line 128 next to
Code:
} // end action==send
When I deleted it, it worked.
If anyone knows the edits for the Create Account pages, please let me know.
Thank you!
Blessings,
K
Bookmarks