Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1486795

    Hi,

    I’m using following code in the functions.php to have “Ja” und blank for “false” in Contact form messages.

    add_filter('avf_form_message', 'avf_form_message_mod_checkbox', 10, 3);
    function avf_form_message_mod_checkbox($message, $new_post, $form_params) {
    	$message = str_replace('true', 'Ja', $message);
    	$message = str_replace('false', '', $message);
        return $message;
    }

    When setting up the Autoresponder I’m still getting “true” and “false”.

    What am I missing to achieve that on that end as well?

    Kind regards.

    • This topic was modified 3 weeks, 6 days ago by tebitrongmbh.
    #1486847

    Hey tebitron,

    Thank you for the inquiry.

    You can use the avf_contact_form_autoresponder_mail to filter the content of the autoresponsder message.

    Example:

    add_filter("avf_contact_form_autoresponder_mail", function($mail_array, $new_post, $form_params, $class) { 
        $mail_array["Message"] = str_replace('true', 'Ja', $mail_array["Message"]);
        $mail_array["Message"] = str_replace('false', '', $mail_array["Message"]);
    
        return $mail_array;
    }, 10, 4);
    

    Let us know the result.

    Best regards,
    Ismael

    #1486879

    Hi Ismael,

    thanks.

    I didn’t replace the other, I just added yours like this:

    add_filter('avf_form_message', 'avf_form_message_mod_checkbox', 10, 3);
    function avf_form_message_mod_checkbox($message, $new_post, $form_params) {
    	$message = str_replace('true', 'Ja', $message);
    	$message = str_replace('false', '', $message);
        return $message;
    }
    
    add_filter("avf_contact_form_autoresponder_mail", function($mail_array, $new_post, $form_params, $class) { 
        $mail_array["Message"] = str_replace('true', 'Ja', $mail_array["Message"]);
        $mail_array["Message"] = str_replace('false', '', $mail_array["Message"]);
    
        return $mail_array;
    }, 10, 4);

    Works perfectly.

    Best regards.

    #1486896

    Hi,

    Great, I’m glad that Ismael could help you out. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

    #1487067

    Thanks Rikard, you can close it.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Alter “true” and “false” in Autoresponder-Email’ is closed to new replies.