Contact Form 7 – reCaptcha v2 - Version 1.1.7

Version Description

(2019-04-26) = * Fixed WPCF7+Flamingo bug which saved un-verified submissions to spam in Flamingo. Thanks @scits!

Download this release

Release Info

Developer IQComputing
Plugin Icon 128x128 Contact Form 7 – reCaptcha v2
Version 1.1.7
Comparing to
See all releases

Code changes from version 1.1.6 to 1.1.7

Files changed (4) hide show
  1. changelog.txt +14 -0
  2. flamingo.php +79 -0
  3. readme.txt +5 -11
  4. wpcf7-recaptcha.php +6 -2
changelog.txt CHANGED
@@ -2,6 +2,20 @@
2
 
3
  This is to keep track of all changes the plugin undertakes. The readme.txt should only contain the most recent 3.
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  = 1.1.6 =
6
 
7
  Release Date: April 02, 2019
2
 
3
  This is to keep track of all changes the plugin undertakes. The readme.txt should only contain the most recent 3.
4
 
5
+ = 1.1.7 =
6
+
7
+ Release Date: April 26, 2019
8
+
9
+ * Overview
10
+ * Contact Forms could still be submitted to Flamingo even when the reCaptcha was not being clicked or interacted with.
11
+ We've hook into before Contact Form 7 does their Flamingo submission and removed the hook if 1) There's a reCaptcha on the form and 2) no reCaptcha verification was found in the submitted data.]
12
+ This should prevent the multitude of spam posts being saved in Flamingo.
13
+ Thanks to @scits to bringing this issue to our attention!
14
+
15
+ * Files Added
16
+ * wpcf7-recaptcha/flamingo.php
17
+ * Only gets included and processed whenever Flamingo is detected to be installed and active.
18
+
19
  = 1.1.6 =
20
 
21
  Release Date: April 02, 2019
flamingo.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file works with reCaptcha v2 to prevent Spam submissions from being stored.
4
+ *
5
+ * Originally, submitting a form without interacting with the reCaptcha box would submit to Contact Form 7
6
+ * And end up being labelled as "Spam" by Flamingo.
7
+ * This update will only check a submission _after_ reCaptcha has been compelted.
8
+ */
9
+
10
+
11
+ defined( 'ABSPATH' ) or die( "Hey, you're not a flamingo! Goodbye." );
12
+
13
+
14
+ Class IQFix_Flamingo {
15
+
16
+
17
+ /**
18
+ * Class Registration, set up necessities
19
+ *
20
+ * @return void
21
+ */
22
+ public static function register() {
23
+
24
+ $selection = WPCF7::get_option( 'iqfix_recaptcha' );
25
+
26
+ if( empty( $selection ) ) {
27
+ return;
28
+ }
29
+
30
+ $class = new self();
31
+ $class->action_hooks();
32
+
33
+ }
34
+
35
+
36
+ /**
37
+ * Add any necessary action hooks
38
+ *
39
+ * @return void
40
+ */
41
+ private function action_hooks() {
42
+
43
+ // See: contact-form-7/modules/flamingo.php
44
+ // Run before priority 10 to shortcircut Flamingo hook
45
+ add_action( 'wpcf7_submit', array( $this, 'flamingo_acceptable_mail' ), 9, 2 );
46
+
47
+ }
48
+
49
+
50
+ /**
51
+ * Remove the flamingo submission hook if our form has a ReCaptcha and an empty ReCaptcha response
52
+ * @see contact-form-7/modules/flamingo.php LN7
53
+ *
54
+ * @param Array $types
55
+ *
56
+ * @return Array $types
57
+ */
58
+ public function flamingo_acceptable_mail( $wpcform, $result ) {
59
+
60
+ $recaptcha = $wpcform->scan_form_tags( array( 'type' => 'recaptcha' ) );
61
+
62
+ if( ! empty( $recaptcha ) ) {
63
+
64
+ if( empty( $_POST['g-recaptcha-response'] ) ) {
65
+
66
+ // Remove the Flamingo hook, don't run it until we have a successful recaptcha
67
+ remove_action( 'wpcf7_submit', 'wpcf7_flamingo_submit', 10 );
68
+
69
+ }
70
+
71
+ }
72
+
73
+ }
74
+
75
+
76
+ } // END IQFix_Flamingo Class
77
+
78
+
79
+ IQFix_Flamingo::register();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: iqcomputing
3
  Tags: contact-form-7, contact-form-7-recaptcha, recaptcha, spam
4
  Requires at least: 4.9
5
  Tested up to: 5.1
6
- Stable tag: 1.1.6
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -60,19 +60,13 @@ Should the above be correct, at this point it's time to open a support thread fo
60
 
61
  == Changelog ==
62
 
 
 
 
63
  = 1.1.6 (2019-04-02) =
64
  * Added localization to reCaptcha API box which translates related text. Thanks @aldebaran57!
65
 
66
  = 1.1.5 (2019-02-25) =
67
 
68
  * Added link to github in description
69
- * Updated version number to fix json checksum (Thanks @willpresleyev)!
70
-
71
- = 1.1.4 (2019-02-21) =
72
- * We need your help translating this plugin! Interested parties may contribute at: https://translate.wordpress.org/projects/wp-plugins/wpcf7-recaptcha
73
- *
74
- * Ensured WordPress 5.1 compatibility
75
- * Removed languages folder to avoid confusion with glotpress.
76
- * Multisite - Network Admins will notice a new menu item under plugins labelled "WPCF7 reCaptcha Settings"
77
- * Multisite - Network Admins now have the ability to add default keys and settings for sites. Individual sites can overwrite these defaults should they choose to.
78
- * Multisite - Default Network settings do not override keys or settings if they are already set/saved on the individual site. These only apply if none are found on the individual site.
3
  Tags: contact-form-7, contact-form-7-recaptcha, recaptcha, spam
4
  Requires at least: 4.9
5
  Tested up to: 5.1
6
+ Stable tag: 1.1.7
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
60
 
61
  == Changelog ==
62
 
63
+ = 1.1.7 (2019-04-26) =
64
+ * Fixed WPCF7+Flamingo bug which saved un-verified submissions to spam in Flamingo. Thanks @scits!
65
+
66
  = 1.1.6 (2019-04-02) =
67
  * Added localization to reCaptcha API box which translates related text. Thanks @aldebaran57!
68
 
69
  = 1.1.5 (2019-02-25) =
70
 
71
  * Added link to github in description
72
+ * Updated version number to fix json checksum (Thanks @willpresleyev)!
 
 
 
 
 
 
 
 
 
wpcf7-recaptcha.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Contact Form 7 - reCaptcha v2
4
  * Description: ReCaptcha v2 Fix for Contact Form 7 5.1 and later.
5
- * Version: 1.1.6
6
  * Author: IQComputing
7
  * Author URI: http://www.iqcomputing.com/
8
  * License: GPL2
@@ -18,7 +18,7 @@ defined( 'ABSPATH' ) or die( 'You cannot be here.' );
18
  */
19
  Class IQFix_WPCF7_Deity {
20
 
21
- public static $version = '1.1.6';
22
 
23
 
24
  /**
@@ -53,6 +53,10 @@ Class IQFix_WPCF7_Deity {
53
  }
54
 
55
  include_once( plugin_dir_path( __FILE__ ) . 'recaptcha-v2.php' );
 
 
 
 
56
 
57
  }
58
 
2
  /**
3
  * Plugin Name: Contact Form 7 - reCaptcha v2
4
  * Description: ReCaptcha v2 Fix for Contact Form 7 5.1 and later.
5
+ * Version: 1.1.7
6
  * Author: IQComputing
7
  * Author URI: http://www.iqcomputing.com/
8
  * License: GPL2
18
  */
19
  Class IQFix_WPCF7_Deity {
20
 
21
+ public static $version = '1.1.7';
22
 
23
 
24
  /**
53
  }
54
 
55
  include_once( plugin_dir_path( __FILE__ ) . 'recaptcha-v2.php' );
56
+
57
+ if( class_exists( 'Flamingo_Contact' ) ) {
58
+ include_once( plugin_dir_path( __FILE__ ) . 'flamingo.php' ); // Flamingo updates
59
+ }
60
 
61
  }
62