Conditional Fields for Contact Form 7 - Version 1.9.8

Version Description

(2020-07-20) = * Make sure all posted data is analyzed after submitting (part of) a form. A recent update of CF7 stripped away some information, resulting in PHP Notices.

Download this release

Release Info

Developer Jules Colle
Plugin Icon 128x128 Conditional Fields for Contact Form 7
Version 1.9.8
Comparing to
See all releases

Code changes from version 1.9.7 to 1.9.8

Files changed (4) hide show
  1. cf7cf.php +2 -28
  2. contact-form-7-conditional-fields.php +1 -1
  3. init.php +1 -1
  4. readme.txt +5 -3
cf7cf.php CHANGED
@@ -30,9 +30,6 @@ class CF7CF {
30
  add_action('wp_ajax_cf7mls_validation', array($this,'cf7mls_validation_callback'),9);
31
  add_action('wp_ajax_nopriv_cf7mls_validation', array($this,'cf7mls_validation_callback'),9);
32
 
33
- // check which fields are hidden during form submission and change some stuff accordingly
34
- add_filter( 'wpcf7_posted_data', array($this, 'remove_hidden_post_data') );
35
-
36
  add_filter( 'wpcf7_validate', array($this, 'skip_validation_for_hidden_fields'), 2, 2 );
37
 
38
  // validation messages
@@ -179,27 +176,6 @@ class CF7CF {
179
 
180
  }
181
 
182
-
183
- /**
184
- * When a CF7 form is posted, check the form for hidden fields, then remove those fields from the post data
185
- *
186
- * @param $posted_data
187
- *
188
- * @return mixed
189
- */
190
- function remove_hidden_post_data($posted_data) {
191
- $this->set_hidden_fields_arrays($posted_data);
192
-
193
- // TODO: activating the code below will change the behaviour of the plugin, as all hidden fields will not be POSTed.
194
- // We might consider activating this based on a setting in the future. But for now, we're not gonna use it.
195
-
196
- // foreach( $this->hidden_fields as $name => $value ) {
197
- // unset( $posted_data[$value] ); // Yes, it should be $value, not $name. https://github.com/pwkip/contact-form-7-conditional-fields/pull/17
198
- // }
199
-
200
- return $posted_data;
201
- }
202
-
203
  function cf7msm_merge_post_with_cookie($posted_data) {
204
 
205
  if (!function_exists('cf7msm_get') || !key_exists('cf7msm_posted_data',$_COOKIE)) return $posted_data;
@@ -210,7 +186,7 @@ class CF7CF {
210
 
211
  // this will temporarily set the hidden fields data to the posted_data.
212
  // later this function will be called again with the updated posted_data
213
- $this->set_hidden_fields_arrays($posted_data);
214
 
215
  // get cookie data
216
  $cookie_data = cf7msm_get('cf7msm_posted_data');
@@ -243,9 +219,7 @@ class CF7CF {
243
  */
244
  function set_hidden_fields_arrays($posted_data = false) {
245
 
246
- if (!$posted_data) {
247
- $posted_data = WPCF7_Submission::get_instance()->get_posted_data();
248
- }
249
 
250
  $hidden_fields = json_decode(stripslashes($posted_data['_wpcf7cf_hidden_group_fields']));
251
  if (is_array($hidden_fields) && count($hidden_fields) > 0) {
30
  add_action('wp_ajax_cf7mls_validation', array($this,'cf7mls_validation_callback'),9);
31
  add_action('wp_ajax_nopriv_cf7mls_validation', array($this,'cf7mls_validation_callback'),9);
32
 
 
 
 
33
  add_filter( 'wpcf7_validate', array($this, 'skip_validation_for_hidden_fields'), 2, 2 );
34
 
35
  // validation messages
176
 
177
  }
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  function cf7msm_merge_post_with_cookie($posted_data) {
180
 
181
  if (!function_exists('cf7msm_get') || !key_exists('cf7msm_posted_data',$_COOKIE)) return $posted_data;
186
 
187
  // this will temporarily set the hidden fields data to the posted_data.
188
  // later this function will be called again with the updated posted_data
189
+ $this->set_hidden_fields_arrays($_POST);
190
 
191
  // get cookie data
192
  $cookie_data = cf7msm_get('cf7msm_posted_data');
219
  */
220
  function set_hidden_fields_arrays($posted_data = false) {
221
 
222
+ if (!$posted_data) $posted_data = $_POST;
 
 
223
 
224
  $hidden_fields = json_decode(stripslashes($posted_data['_wpcf7cf_hidden_group_fields']));
225
  if (is_array($hidden_fields) && count($hidden_fields) > 0) {
contact-form-7-conditional-fields.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Contact Form 7 Conditional Fields
4
  Plugin URI: http://bdwm.be/
5
  Description: Adds support for conditional fields to Contact Form 7. This plugin depends on Contact Form 7.
6
  Author: Jules Colle
7
- Version: 1.9.7
8
  Author URI: http://bdwm.be/
9
  */
10
 
4
  Plugin URI: http://bdwm.be/
5
  Description: Adds support for conditional fields to Contact Form 7. This plugin depends on Contact Form 7.
6
  Author: Jules Colle
7
+ Version: 1.9.8
8
  Author URI: http://bdwm.be/
9
  */
10
 
init.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- if (!defined('WPCF7CF_VERSION')) define( 'WPCF7CF_VERSION', '1.9.7' );
4
  if (!defined('WPCF7CF_REQUIRED_WP_VERSION')) define( 'WPCF7CF_REQUIRED_WP_VERSION', '4.1' );
5
  if (!defined('WPCF7CF_PLUGIN')) define( 'WPCF7CF_PLUGIN', __FILE__ );
6
  if (!defined('WPCF7CF_PLUGIN_BASENAME')) define( 'WPCF7CF_PLUGIN_BASENAME', plugin_basename( WPCF7CF_PLUGIN ) );
1
  <?php
2
 
3
+ if (!defined('WPCF7CF_VERSION')) define( 'WPCF7CF_VERSION', '1.9.8' );
4
  if (!defined('WPCF7CF_REQUIRED_WP_VERSION')) define( 'WPCF7CF_REQUIRED_WP_VERSION', '4.1' );
5
  if (!defined('WPCF7CF_PLUGIN')) define( 'WPCF7CF_PLUGIN', __FILE__ );
6
  if (!defined('WPCF7CF_PLUGIN_BASENAME')) define( 'WPCF7CF_PLUGIN_BASENAME', plugin_basename( WPCF7CF_PLUGIN ) );
readme.txt CHANGED
@@ -6,7 +6,7 @@ Website: http://bdwm.be
6
  Tags: wordpress, contact form 7, forms, conditional fields
7
  Requires at least: 4.1
8
  Tested up to: 5.4.2
9
- Stable tag: 1.9.7
10
  Requires PHP: 5.6
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -60,7 +60,7 @@ Advanced users can code up the conditions as plain text instead of using the sel
60
 
61
  == Need more power? ==
62
 
63
- Just like WordPress, the power of Contact Form 7 lies in its rich eco-system of extensions that build on top of it. However, it can be difficult to find a set of complex extensions that work well together.
64
 
65
  That's why I created Conditional Fields Pro. It adds some powerful features to Contact form 7 and guarantees that everything will run smoothly with Conditional Fields.
66
 
@@ -117,6 +117,9 @@ The conditional fields javascript code is loaded during wp_footer, so a call to
117
 
118
  == Changelog ==
119
 
 
 
 
120
  = 1.9.7 (2020-07-07) =
121
  * fix IE11 compatibility
122
 
@@ -450,4 +453,3 @@ Fixed bug with exclusive checkboxes (https://wordpress.org/support/topic/groups-
450
  First release
451
 
452
 
453
-
6
  Tags: wordpress, contact form 7, forms, conditional fields
7
  Requires at least: 4.1
8
  Tested up to: 5.4.2
9
+ Stable tag: 1.9.8
10
  Requires PHP: 5.6
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
60
 
61
  == Need more power? ==
62
 
63
+ Just like WordPress, the power of Contact Form 7 lies in its [rich eco-system of extensions](https://conditional-fields-cf7.bdwm.be/list-of-all-contact-form-7-extensions/) that build on top of it. However, it can be difficult to find a set of complex extensions that work well together.
64
 
65
  That's why I created Conditional Fields Pro. It adds some powerful features to Contact form 7 and guarantees that everything will run smoothly with Conditional Fields.
66
 
117
 
118
  == Changelog ==
119
 
120
+ = 1.9.8 (2020-07-20) =
121
+ * Make sure all posted data is analyzed after submitting (part of) a form. A recent update of CF7 stripped away some information, resulting in PHP Notices.
122
+
123
  = 1.9.7 (2020-07-07) =
124
  * fix IE11 compatibility
125
 
453
  First release
454
 
455