• Resolved kostaspapadakis

    (@kostaspapadakis)


    Hi Mario,

    could you please let me know if/how can I pass the hidden special fields from CF7 like _remote_ip and _url into the Zapier webhook?

    Thank you,
    Kostas

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Mário Valney

    (@mariovalney)

    Hi @kostaspapadakis, how are you?

    By now it’s not possible to add Special Mail Tags to Zapier data as there’s no form tag to them. But you can add this data using our filter ctz_get_data_from_contact_form:

    add_filter( 'ctz_get_data_from_contact_form', 'kostaspapadakis_add_data_to_zapier', 10, 2 );
    
    function kostaspapadakis_add_data_to_zapier( $data, $contact_form ) {
        $submission = WPCF7_Submission::get_instance();
    
        if ( empty( $submission ) ) return $data;
    
        $remote_ip = $submission->get_meta( 'remote_ip' );
        $url = $submission->get_meta( 'url' );
    
        $data['_remote_ip'] = ( ! empty( $remote_ip ) ) ? $remote_ip : '';
        $data['_url'] = ( ! empty( $url ) ) ? esc_url( $url ) : '';
    
        return $data;
    }

    You can change ‘_remote_ip’ and ‘_url’ keys to any value you want to sendo as key to Zapier.

    Thanks for using our plugin!

    Thread Starter kostaspapadakis

    (@kostaspapadakis)

    I am fine Thanks Mario and hope the same…

    Also thanks for the solution.

    Best,
    Kostas

    @mariovalney I am interested in this as well. Sorry I am not super technical but where do i paste that piece of code?

    Plugin Author Mário Valney

    (@mariovalney)

    Hi @aspenaus, how are you?

    You can put this snippet on functions.php or create a simple plugin.

    Just remember you can lost changes in a 3rd part theme if it updates. So consider create a child theme if you are using a theme created by someone else. And always backup! ??

    tylertrowbridge

    (@tylertrowbridge)

    Hi @mariovalney I’m hoping you can assist?

    I have adapted the code you shared above and it is working for _url, _user_agent, and _remote_ip — however it is not working for _time, _date, _post_title

    Can you please advise on how I can get those special mail tags into my Zapier?

    Thank you @mariovalney

    <?php 
    
    add_filter( 'ctz_get_data_from_contact_form', 'ds_add_data_to_zapier', 10, 2 );
    
    function ds_add_data_to_zapier( $data, $contact_form ) {
        $submission = WPCF7_Submission::get_instance();
    
        if ( empty( $submission ) ) return $data;
    
        $post_title = $submission->get_meta( 'post_title' );
        $remote_ip = $submission->get_meta( 'remote_ip' );
        $url = $submission->get_meta( 'url' );
        $user_agent = $submission->get_meta( 'user_agent' );
        $date = $submission->get_meta( 'date' );
       	$time = $submission->get_meta( 'time' );
    
        $data['post_title'] = ( ! empty( $post_title ) ) ? $post_title : '';
        $data['ip'] = ( ! empty( $remote_ip ) ) ? $remote_ip : '';
        $data['referrer'] = ( ! empty( $url ) ) ? esc_url( $url ) : '';
        $data['ua'] = ( ! empty( $user_agent ) ) ? esc_url( $user_agent ) : '';
        $data['date'] = ( ! empty( $date ) ) ? esc_url( $date ) : '';
        $data['time'] = ( ! empty( $time ) ) ? esc_url( $time ) : '';
    
        return $data;
    }
    
    ?>
    Plugin Author Mário Valney

    (@mariovalney)

    Hi Tyler,
    can you check if $post_title, $date and $time have any value?

    Maybe print or a error_log value?

    He,
    Did you find the problem? I’m also experience this problem with the $date and $time value that get to Zapier with now data.

    I ended up using additional Javascript on my own to generate the page url, and timestamp myself—i made these hidden fields in the CF7 form code. Then I used Special hidden fields to pull those values from CF7 into Zaiper.

    As a plus it allowed me the ability to preform my data before sending to Zapier

    Plugin Author Mário Valney

    (@mariovalney)

    Hi!

    We released today a new version (1.3.0) to support Special Mail Tags.

    To send it to Zapier you should add the tag to the new option field as shown in the Screenshot 1.

    Thank you @mariovalney I will try this out.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Special Hidden Fields into Zapier’ is closed to new replies.