Conditional Fields for Contact Form 7 - Version 0.2.9

Version Description

  • Re-added wpcf7_add_shortcode() function if wpcf7_add_form_tag() is not found, because some people claimed to get a "function not found" error for the wpcf7_add_form_tag function with the latest version of CF7 installed. (https://wordpress.org/support/topic/activation-issue-5/ and https://wordpress.org/support/topic/http-500-unable-to-handle-request-error-after-update/)
  • Fixed some PHP notices (https://wordpress.org/support/topic/undefined-index-error-in-ajax-response/)
  • Attempted to fix error with the CF7 success page redirects plugin (https://wordpress.org/support/topic/warning-invalid-argument-error-for-forms-without-conditional-fields/)
Download this release

Release Info

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

Code changes from version 0.2.8 to 0.2.9

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: 0.2.8
8
  Author URI: http://bdwm.be/
9
  */
10
 
@@ -92,7 +92,13 @@ class ContactForm7ConditionalFields {
92
  public static function add_shortcodes() {
93
  //wpcf7_add_shortcode('group', array(__CLASS__, 'shortcode_handler'), true);
94
  //add_shortcode( 'group', array(__CLASS__, 'group_shortcode_handler') );
95
- wpcf7_add_form_tag('group', array(__CLASS__, 'shortcode_handler'), true);
 
 
 
 
 
 
96
  }
97
 
98
  function group_shortcode_handler( $atts, $content = "" ) {
@@ -174,6 +180,8 @@ class ContactForm7ConditionalFields {
174
 
175
  $invalid_fields = $result->get_invalid_fields();
176
 
 
 
177
  foreach ($invalid_fields as $invalid_field_key => $invalid_field_data) {
178
  if (!in_array($invalid_field_key, $this->hidden_fields)) {
179
  // the invalid field is not a hidden field, so we'll add it to the final validation result
@@ -238,7 +246,9 @@ class ContactForm7ConditionalFields {
238
  return $components;
239
  }
240
 
241
- function hide_hidden_mail_fields_additional_mail($additional_mail, $contact_form) {;
 
 
242
 
243
  $regex = '@\[[\t ]*([a-zA-Z_][0-9a-zA-Z:._-]*)[\t ]*\](.*?)\[[\t ]*/[\t ]*\1[\t ]*\]@s';
244
 
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: 0.2.9
8
  Author URI: http://bdwm.be/
9
  */
10
 
92
  public static function add_shortcodes() {
93
  //wpcf7_add_shortcode('group', array(__CLASS__, 'shortcode_handler'), true);
94
  //add_shortcode( 'group', array(__CLASS__, 'group_shortcode_handler') );
95
+ if (function_exists('wpcf7_add_form_tag'))
96
+ wpcf7_add_form_tag('group', array(__CLASS__, 'shortcode_handler'), true);
97
+ else if (function_exists('wpcf7_add_shortcode')) {
98
+ wpcf7_add_shortcode('group', array(__CLASS__, 'shortcode_handler'), true);
99
+ } else {
100
+ throw new Exception('functions wpcf7_add_form_tag and wpcf7_add_shortcode not found.');
101
+ }
102
  }
103
 
104
  function group_shortcode_handler( $atts, $content = "" ) {
180
 
181
  $invalid_fields = $result->get_invalid_fields();
182
 
183
+ if (!is_array($invalid_fields) || count($invalid_fields) == 0) return $result;
184
+
185
  foreach ($invalid_fields as $invalid_field_key => $invalid_field_data) {
186
  if (!in_array($invalid_field_key, $this->hidden_fields)) {
187
  // the invalid field is not a hidden field, so we'll add it to the final validation result
246
  return $components;
247
  }
248
 
249
+ function hide_hidden_mail_fields_additional_mail($additional_mail, $contact_form) {
250
+
251
+ if (!is_array($additional_mail) || !array_key_exists('mail_2', $additional_mail)) return $additional_mail;
252
 
253
  $regex = '@\[[\t ]*([a-zA-Z_][0-9a-zA-Z:._-]*)[\t ]*\](.*?)\[[\t ]*/[\t ]*\1[\t ]*\]@s';
254
 
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: 4.7
9
- Stable tag: 0.2.8
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -47,6 +47,11 @@ Because no questions have been asked frequently about this plugin.
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
50
  = 0.2.8 =
51
  * forgot to update version number in 0.2.7, so changing version to 0.2.8 now.
52
 
6
  Tags: wordpress, contact form 7, forms, conditional fields
7
  Requires at least: 4.1
8
  Tested up to: 4.7
9
+ Stable tag: 0.2.9
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
47
 
48
  == Changelog ==
49
 
50
+ = 0.2.9 =
51
+ * Re-added wpcf7_add_shortcode() function if wpcf7_add_form_tag() is not found, because some people claimed to get a "function not found" error for the wpcf7_add_form_tag function with the latest version of CF7 installed. (https://wordpress.org/support/topic/activation-issue-5/ and https://wordpress.org/support/topic/http-500-unable-to-handle-request-error-after-update/)
52
+ * Fixed some PHP notices (https://wordpress.org/support/topic/undefined-index-error-in-ajax-response/)
53
+ * Attempted to fix error with the CF7 success page redirects plugin (https://wordpress.org/support/topic/warning-invalid-argument-error-for-forms-without-conditional-fields/)
54
+
55
  = 0.2.8 =
56
  * forgot to update version number in 0.2.7, so changing version to 0.2.8 now.
57