If anyone is using the "CAPTCHA using TTF & GD" mod and wanted to add that CAPTCHA mod to the forms created from this mod here's down and dirty what I did:
In the form you created located in "includes/templates/YOUR_TEMPLATE/templates" find this:
Paste the following just above thisCode:</fieldset> <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div>
In your header_php.php located in "includes/modules/pages/YOUR_FORM" find this:Code:<?php // BOF Captcha if(is_object($captcha) && (!$_SESSION['customer_id'])) { ?> <br class="clearBoth" /> <?php echo $captcha->img(); ?> <?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?> <br class="clearBoth" /> <label for="captcha"><?php echo TITLE_CAPTCHA; ?></label> <?php echo $captcha->input_field('captcha', 'id="captcha"') . ' <span class="alert">' . TEXT_CAPTCHA . '</span>'; ?> <br class="clearBoth" /> <?php } // BOF Captcha ?>
Just below this add:Code:require(DIR_WS_MODULES . 'require_languages.php'); $breadcrumb->add(NAVBAR_TITLE);
Then find this:Code:// BOF Captcha if(CAPTCHA_CONTACT_US != 'false') { require(DIR_WS_CLASSES . 'captcha.php'); $captcha = new captcha(); } // EOF Captcha
And just above it paste this:Code:if ($error == false) { // grab some customer info if logged in if(isset($_SESSION['customer_id'])) {
I think this covers everything I did.. (Hopefully I didn't overlook anything) So far my testing shows this works just perfectly..Code:// BOF Captcha Validation if (is_object($captcha) && !$captcha->validateCaptchaCode()) { $error = true; $messageStack->add('customer_questionnaire', ERROR_CAPTCHA); } // EOF Captcha Validation
Here's the source I used: http://www.zen-cart.com/forum/showpo...&postcount=284
This post shows how to add the CAPTCHA to the Returns Authorization form, but it was pretty to adapt the instructions here to work with this form.. Hopefully someone else will find it useful too..


Reply With Quote
