• Resolved georgepennet

    (@georgepennet)


    Hi.

    I bought you pro API and everything works great but the problem is that your plugin doesn’t support conditional fields plugin.

    I made a groups with that plugin. If client will choose one option then group “group1” will be visible. If he choose other option then group “group2” should be visible.

    In email message it looks like this:

    [group1]Message1[/group1][group2]Message2[/group2]

    And it actually works. Depending on the answer it will show Message1 or Message2.

    On PDF it doesn’t work – I can see only full code. I thought that everything that works with email will also work on PDF. Any solution?

Viewing 1 replies (of 1 total)
  • Plugin Author maximum.software

    (@maximumsoftware)

    Hi,

    I did not realize your use case wasn’t working, but I looked into it and here is what I concluded:

    The problem is not that my plugin doesn’t support the Conditional Fields for Contact Form 7 plugin. As far as I can tell, the problem is that the Conditional Fields for Contact Form 7 plugin doesn’t hook into the wpcf7_mail_replace_tags() function to handle groups in mail-tags, and that the Contact Form 7 plugin doesn’t provide an easy way for Conditional Fields for Contact Form 7 to hook into the wpcf7_mail_replace_tags() function.

    The groups are working in the email message because Conditional Fields for Contact Form 7 plugin has code that handles groups in email message (see function hide_hidden_mail_fields()). However, as far as I can tell, this code doesn’t run for mail-tags that are outside of CF7 form properties (including when wpcf7_mail_replace_tags() is called). My plugin calls wpcf7_mail_replace_tags() to process mail-tags, so, the Conditional Fields for Contact Form 7 groups never get processed.

    I will explain how to make it work with my plugin (as a temporary workaround).
    Change this line in my plugin’s main PHP file:

    $data[$field] = wpcf7_mail_replace_tags( $mapping["mail_tags"] );
    

    To the following:

    $data[$field] = wpcf7_mail_replace_tags( $mapping["mail_tags"] );
    if( class_exists( 'Wpcf7cfMailParser' ) )
    {
    	$hidden_groups = json_decode(stripslashes($_POST['_wpcf7cf_hidden_groups']));
    	$visible_groups = json_decode(stripslashes($_POST['_wpcf7cf_visible_groups']));
    	$repeaters = json_decode(stripslashes($_POST['_wpcf7cf_repeaters']));
    	$parser = new Wpcf7cfMailParser($data[$field], $visible_groups, $hidden_groups, $repeaters, $_POST);
    	$data[$field] = $parser->getParsedMail();
    }
    

    Image embeds, file name, and save path mail-tag processing code will need a similar change if you want to use conditional field groups there as well.

    I will not be adding the above code into my plugin because this is a responsibility of the Conditional Fields for Contact Form 7 plugin developer and the Contact Form 7 plugin developer, unless someone can prove otherwise.

    Even if I moved the mail-tag containing settings of my plugin into Contact Form 7 form properties, that is still not going to solve the problem because Conditional Fields for Contact Form 7 plugin only seems to process ‘mail’, ‘mail_2’, and ‘messages’ properties.

    Please contact the developers of both plugins and direct them to this forum topic.

    Thank you.

Viewing 1 replies (of 1 total)
  • The topic ‘conditional-fields-cf7 support’ is closed to new replies.