Snaptcha
ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6
Back to this add-on's main page
View Other Add-ons From Brian Litzinger
Mailing List Form revisited
Support (Resolved)
Darin
|
Posted: 22 April 2017 11:58 AM |
|
|
|
Can legacy Snaptcha 1.7.6 now be used with EE2’s mailing list form by including {exp:snaptcha:field} in the form?
If so, where do I put the validation code shown in the developer docs?
|
|
|
PutYourLightsOn
|
Posted: 23 April 2017 02:13 PM |
# 1
|
|
|
If you wanted to alter the core Mailing List module file, you could insert code to validate a submission which had used {exp:snaptcha:field}, yes. You’d want to insert the validation code inside the insert_new_email() method of the Mailing List module, somewhere in the “error trapping” portion of the code, so you could add to the array of errors in the case that the validation failed.
|
|
|
Darin
|
Posted: 23 April 2017 04:51 PM |
# 2
|
|
|
Once I figured out that I still had to test the submission against Snaptcha’s validation, it worked great. Thank you!
For anyone who is interested, here’s the code I inserted at line 159 of system/expressionengine/modules/mailinglist/mod.mailinglist.php (EE 2.11.7)
require_once PATH_THIRD.'snaptcha/ext.snaptcha'.EXT; $Snaptcha = new Snaptcha_ext(); $validated = $Snaptcha->snaptcha_validate(); // returns a boolean (true or false) if ( ! $validated) { $errors[] = $Snaptcha->settings['error_message']; }
|
|
|
PutYourLightsOn
|
Posted: 23 April 2017 05:06 PM |
# 3
|
|
|
Excellent, glad you sorted that out Darin.
|
|
|