Gravity Forms Zero Spam - Version 1.0.7

Version Description

on March 18, 2021 =

  • Fixed: All entries marked as spam for AJAX-enabled forms. Sorry, folks! Won't happen again.
  • Went back to using jQuery to listen to form submissions.
Download this release

Release Info

Developer gravityview
Plugin Icon 128x128 Gravity Forms Zero Spam
Version 1.0.7
Comparing to
See all releases

Code changes from version 1.0.6.1 to 1.0.7

Files changed (2) hide show
  1. gravityforms-zero-spam.php +13 -19
  2. readme.txt +5 -0
gravityforms-zero-spam.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Gravity Forms Zero Spam
4
  * Plugin URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=pluginuri
5
  * Description: Enhance Gravity Forms to include effective anti-spam measures—without using a CAPTCHA.
6
- * Version: 1.0.6.1
7
  * Author: GravityView
8
  * Author URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=authoruri
9
  * License: GPL-2.0+
@@ -69,24 +69,18 @@ class GF_Zero_Spam {
69
  public function add_key_field() {
70
  ?>
71
  <script type='text/javascript'>
72
- document.addEventListener("DOMContentLoaded", function() {
73
- var gforms = '.gform_wrapper form';
74
-
75
- var el = document.querySelector( gforms );
76
-
77
- if ( ! el ) {
78
- return;
79
- }
80
-
81
- el.addEventListener( "submit", function ( e ) {
82
- var input = document.createElement( "input" );
83
- input.type = 'hidden';
84
- input.name = 'gf_zero_spam_key';
85
- input.value = '<?php echo esc_js( $this->get_key() ); ?>';
86
-
87
- e.target.appendChild( input );
88
- } );
89
- });
90
  </script>
91
  <?php
92
  }
3
  * Plugin Name: Gravity Forms Zero Spam
4
  * Plugin URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=pluginuri
5
  * Description: Enhance Gravity Forms to include effective anti-spam measures—without using a CAPTCHA.
6
+ * Version: 1.0.7
7
  * Author: GravityView
8
  * Author URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=authoruri
9
  * License: GPL-2.0+
69
  public function add_key_field() {
70
  ?>
71
  <script type='text/javascript'>
72
+ if ( window.jQuery ) {
73
+ jQuery( document ).ready( function ( $ ) {
74
+ var gforms = '.gform_wrapper form';
75
+ $( document ).on( 'submit', gforms, function () {
76
+ $( '<input>' ).attr( 'type', 'hidden' )
77
+ .attr( 'name', 'gf_zero_spam_key' )
78
+ .attr( 'value', '<?php echo esc_js( $this->get_key() ); ?>' )
79
+ .appendTo( gforms );
80
+ return true;
81
+ } );
82
+ } );
83
+ }
 
 
 
 
 
 
84
  </script>
85
  <?php
86
  }
readme.txt CHANGED
@@ -30,6 +30,11 @@ No. For that, we recommend Ben Marshall‘s [WordPress Zero Spam plugin](https:/
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
33
  = 1.0.6.1 on March 15, 2021 =
34
 
35
  * Fixed: JavaScript "null is not an object (evaluating 'el.addEventListener')" error on pages without a form
30
 
31
  == Changelog ==
32
 
33
+ = 1.0.7 on March 18, 2021 =
34
+
35
+ * Fixed: All entries marked as spam for AJAX-enabled forms. Sorry, folks! Won't happen again.
36
+ * Went back to using jQuery to listen to form submissions.
37
+
38
  = 1.0.6.1 on March 15, 2021 =
39
 
40
  * Fixed: JavaScript "null is not an object (evaluating 'el.addEventListener')" error on pages without a form