WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
How can i handle custom response? (2 posts)

  1. DDT
    Member
    Posted 5 months ago #

    Hello,

    I just manage to modify the action url by

    add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url2');
    function wpcf7_custom_form_action_url2($url){
        global $post, $wpcf7;
         if ($post->ID === 162) {
    // stop email being sent
           $wpcf7->skip_mail = 1;
            return '/tickets/get.php';
        } else {
            return $url;
        }
     }

    and get.php just outputs the variables

    print_r($_REQUEST);
    and i see

    Array
    (
        [_wpcf7] => 159
        [_wpcf7_version] => 3.7.1
        [_wpcf7_locale] => en_US
        [_wpcf7_unit_tag] => wpcf7-f159-p162-o1
        [_wpnonce] => 270977c76b
        [your-name] => asdf
        [your-subject] => sd
        [your-message] => adsf
        [_wpcf7_is_ajax_call] => 1
    )

    but i like to get this output in place of the CF7 form is this possible?

    How does wpcf7 handle the response?

    https://wordpress.org/plugins/contact-form-7/

  2. DDT
    Member
    Posted 5 months ago #

    hmm, which variables can be used to trick WPCF7

    if i just echo this in get.php

    echo '{"mailSent":true,"into":"#wpcf7-f159-p162-o1","captcha":null,"message":"Lets do a dance."}';

    it get displayed. But i don't like it to be the message variable, can you add anything?

    Is there a list of variable which can be used to echo back like message, mailSent

Reply

You must log in to post.

About this Plugin

About this Topic

Tags