• Resolved noapi1

    (@noapi1)


    Hi,

    I have some conditional groups in a form and form email body, which show different texts in the sent emails like

    [group-modulu]Show this only when Modul U is selected.[/group-modulu]

    Works as expected. But when I use the same conditions in the wpcf7_before_send_mail action, the tags “[group-modulu]” are shown in the email instead of being executed/replaced.

    I want to send the mail_2 email with these conditions, but it seems that cf7-conditional-fields is not executed on wpcf7_before_send_mail. Any help here?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    Sorry, I don’t have much time for this support forum lately. I think this is the hook I use to replace the HTML:

    add_action("wpcf7_before_send_mail", [$this, 'hide_hidden_mail_fields'], 10, 3);

    So I think you need to make sure you call the action with a priority greater than 10 to make sure the invisible groups are removed by the time your hook is triggered.

    Thread Starter noapi1

    (@noapi1)

    Thank you, great, it works with that:

    add_action("wpcf7_before_send_mail", [$this, 'hide_hidden_mail_fields'], 5, 3);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to compile conditional groups in wpcf7_before_send_mail?’ is closed to new replies.