__( 'Conditional fields', 'cf7-conditional-fields' ), 'callback' => 'wpcf7cf_editor_panel_conditional' ); } return $panels; } function wpcf7cf_all_field_options($post, $selected = '-1') { $all_fields = $post->scan_form_tags(); ?> scan_form_tags(array('type'=>'group')); ?> ' ? 'greater than' : $selected; $selected = $selected == '<' ? 'less than' : $selected; ?>


id(); if ( ! $post_id ) { return; } // we intentionally don't use sanitize_textarea_field here, // because basically any character is a valid character. // To arm agains SQL injections and other funky junky, the CF7CF::parse_conditions function is used. $conditions_string = stripslashes($_POST['wpcf7cf-settings-text']); $conditions = CF7CF::parse_conditions($conditions_string); CF7CF::setConditions($post_id, $conditions); if (isset($_POST['wpcf7cf-summary-template'])) { WPCF7CF_Summary::saveSummaryTemplate($_POST['wpcf7cf-summary-template'],$post_id); } }, 8, 1 ); // duplicate conditions on duplicate form part 1. add_filter('wpcf7_copy','wpcf7cf_copy', 10, 2); function wpcf7cf_copy($new_form,$current_form) { $id = $current_form->id(); $props = $new_form->get_properties(); $props['messages']['wpcf7cf_copied'] = $id; $new_form->set_properties($props); return $new_form; } // duplicate conditions on duplicate form part 2. add_action('wpcf7_after_save','wpcf7cf_after_save',10,1); function wpcf7cf_after_save($contact_form) { $props = $contact_form->get_properties(); $original_id = isset($props['messages']['wpcf7cf_copied']) ? $props['messages']['wpcf7cf_copied'] : 0; if ($original_id !== 0) { $post_id = $contact_form->id(); unset($props['messages']['wpcf7cf_copied']); $contact_form->set_properties($props); CF7CF::setConditions($post_id, CF7CF::getConditions($original_id)); return; } } function wpcf7cf_sanitize_options($options) { //$options = array_values($options); $sanitized_options = []; foreach ($options as $option_entry) { $sanitized_option = []; $sanitized_option['then_field'] = sanitize_text_field($option_entry['then_field']); foreach ($option_entry['and_rules'] as $and_rule) { $sanitized_option['and_rules'][] = [ 'if_field' => sanitize_text_field($and_rule['if_field']), 'operator' => $and_rule['operator'], 'if_value' => sanitize_text_field($and_rule['if_value']), ]; } $sanitized_options[] = $sanitized_option; } return $sanitized_options; } add_action('admin_notices', function () { $settings = wpcf7cf_get_settings(); $nid = 'install-cf7'; if (!defined('WPCF7_VERSION') && empty($settings['notice_dismissed_'.$nid]) && current_user_can('update_plugins') ) { ?>

Conditional Fields for Contact Form 7 depends on Contact Form 7. Please install Contact Form 7.

Conditional Fields for Contact Form 7 is not yet tested with your current version of Contact Form 7.
If you notice any problems with your forms, please roll back to Contact Form 7 version .
For a quick and safe rollback, we recommend WP Rollback.

' ) && empty($settings['notice_dismissed_'.$nid]) && current_user_can('update_plugins') ) { ?>

Conditional Fields for Contact Form 7 is fully compatible and tested with Contact Form 7 version .
Compatibility with other versions of CF7 is not guaranteed, so please install CF7 version