Support » Plugin: CF7 to Webhook » Problema when inserting webhook

  • Hi there,

    first of all, great plugin! Its the third time that I’m using it.
    I’m having problems on this form when I activate the Send to Webhook option: https://refugees-welcome.it/test/
    There is no explanation so I cannot figure out what’s happening.

    Thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter mirconatili

    (@mirconatili)

    Sorry, just another related question: is that a POST request from the plugin?

    Plugin Author Mario Valney

    (@mariovalney)

    Hi.

    Sorry, just another related question: is that a POST request from the plugin?

    Yepp. As you can check here.

    There is no explanation so I cannot figure out what’s happening.

    Maybe activate WP_DEBUG can lead you to any server error.

    If you are OK with code, you can add erro_log after request too, to check the response. And/or use this site to check the request is being sent.

    Thread Starter mirconatili

    (@mirconatili)

    Ok, i’m getting closer to the problem.
    I’ve inserted two hidden value and the output has to be
    ” crm_anagrafica_web_c”:”1″,
    “crm_cosa_offre_c[]”:”Capacita_tempo”

    But on cf7 i cannot insert space or [] in a field name, how can i do?

    Plugin Author Mario Valney

    (@mariovalney)

    Yeah.. I was not able to figured out a way to send [] in field name…

    I thinked about renaming your field but I just discovered CF7 don’t accept [] even in options and there’s no way to escape it (due to regex used by CF7).

    So.. we should use filters.

    add_filter( 'ctz_get_data_from_contact_form', 'mirconatili_ctz_get_data_from_contact_form' );
    function mirconatili_ctz_get_data_from_contact_form( $data ) {
        if ( isset( $data['crm_cosa_offre_c'] ) ) {
            $data['crm_cosa_offre_c[]'] = $data['crm_cosa_offre_c'];
            unset( $data['crm_cosa_offre_c'] );
        }
    
        return $data;
    }
    Thread Starter mirconatili

    (@mirconatili)

    Hi there,

    I inserted the code in function.php but, testing with weebhook.site , it still goes “crm_cosa_offre_c”.

    Do you know another possible solutions?

    Plugin Author Mario Valney

    (@mariovalney)

    This is the solution. I tested.

    The form

    The result

    Please check you copied the code correctly and all the fields.
    Maybe “var_dump” data after “IF”?

    Thread Starter mirconatili

    (@mirconatili)

    Sorry, nope.
    Without var_dump the field is not visible
    https://paste.pics/484f0e09076ec0d2223f72d0f54a84c9
    With var_dump the field is still the same
    https://paste.pics/d7389c59d1ac104b431fc2095c5343b5

    Plugin Author Mario Valney

    (@mariovalney)

    The function “var_dump” would print the field in your console when requesting the form. Anyway… It was just a simple suggestion do debug.

    Remove it please and let’s restart.

    First of all, please recheck your tests. In your page I saw 3 forms with “crm_cosa_offre_c” and “crm_cosa_offre_c[]” inputs.

    Please provide:

    1 – A print of your CF7 form.
    2 – A print of your Webhook configurations.

    Activate the DEBUG mode:

    Debugging in WordPress

    Change the code to this and show me the output in logs:

    add_filter( 'ctz_get_data_from_contact_form', 'mirconatili_ctz_get_data_from_contact_form' );
    function mirconatili_ctz_get_data_from_contact_form( $data ) {
        error_log( print_r( $data, true ) );
    
        if ( isset( $data['crm_cosa_offre_c'] ) ) {
            $data['crm_cosa_offre_c[]'] = $data['crm_cosa_offre_c'];
            unset( $data['crm_cosa_offre_c'] );
        }
    
        error_log( print_r( $data, true ) );
    
        return $data;
    }
Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.