brunojlt
Forum Replies Created
-
Forum: Plugins
In reply to: [CF7 to Webhook] free_text input from radio/checkbox not being sentIt worked by changing this:
$free_text_name = sprintf( '_wpcf7_%1$s_free_text_%2$s', $tag->basetype, $tag->name );
Into this:
$free_text_name = sprintf( '%1$s_free_text', $tag->name );
In the class-module-cf7.php
Forum: Plugins
In reply to: [CF7 to Webhook] free_text input from radio/checkbox not being sentDamn I can’t properly add images into the reply haha
How did you do?
Forum: Plugins
In reply to: [CF7 to Webhook] free_text input from radio/checkbox not being sentYep, I am using the latest version of the plugin.
Regarding the Bad Request, I solved it changing the Data Type required in the schema by Microsoft Power Automate from string to array. Now all the options appear correctly.
Now, regarding the missing free_text values, I think I found the problem.
CF7 had a major update on 4th July: https://contactform7.com/2020/07/04/contact-form-7-52/#more-36548
And it seems that they changed how the free_text field name in the POST array is added.
Here is my form:
[img]https://imgur.com/sVvjCp9[/img]
[img]https://i.imgur.com/YyoV0MX.png[/img]
Look at the debug here:
[img]https://i.imgur.com/Sg0ACFS.png[/img]
Look how the free_text doesn’t have the “_wpcf7_” prefix anymore.
Forum: Plugins
In reply to: [CF7 to Webhook] free_text input from radio/checkbox not being sentHi, Mario, how are you?
I faced another issue and tried to update the plugin (haven’t done that since now).
Found two issues:
1. The free_text is not being received at the WebHook, I can send you screenshoots, just tell me where is easier for you.
2. When the checkbox is not exclusive, that is, more than one option can be selected, I get a Bad Request on my WebHook. When the checkbox is exclusive, the request works ok, but not receiving the free_text value.I’m using Microsoft Power Automate as WebHook, not Zappier.
Can you please give a look?
Forum: Plugins
In reply to: [CF7 to Webhook] free_text input from radio/checkbox not being sentOh, sorry, I didn’t notice!
I’ll update the plugin.
Forum: Plugins
In reply to: [CF7 to Webhook] free_text input from radio/checkbox not being sentIn case someone needs a temporary solution, I updated the function get_data_from_contact_form in the /cf7-to-zapier/modules/cf7/class-module-cf7.php to get it working:
private function get_data_from_contact_form($contact_form) { $data = []; // Submission $submission = WPCF7_Submission::get_instance(); $files = (!empty($submission)) ? $submission->uploaded_files() : []; // Upload Info $wp_upload_dir = wp_get_upload_dir(); $upload_path = CFTZ_UPLOAD_DIR . '/' . $contact_form->id() . '/' . uniqid(); $upload_url = $wp_upload_dir['baseurl'] . '/' . $upload_path; $upload_dir = $wp_upload_dir['basedir'] . '/' . $upload_path; $tags = $contact_form->scan_form_tags(); foreach ($tags as $tag) { if (empty($tag->name)) { continue; } // Regular Tags $value = (!empty($_POST[$tag->name])) ? $_POST[$tag->name] : ''; // Tag with free_text option foreach ($tag->options as $option) { if ($option == 'free_text') { // if array exists, there is input on the free_text option if (array_key_exists('_wpcf7_' . $tag->type . '_free_text_' . $tag->name, $_POST)) { $value = $_POST['_wpcf7_' . $tag->type . '_free_text_' . $tag->name]; $value = (!empty($value)) ? $_POST[$tag->name] . ': ' . $value : $_POST[$tag->name] . ': n?£o especificado'; } else { } } } if (is_array($value)) { foreach ($value as $key => $v) { $value[$key] = stripslashes($v); } } if (is_string($value)) { $value = stripslashes($value); } // Files if ($tag->basetype === 'file' && !empty($files[$tag->name])) { $file = $files[$tag->name]; wp_mkdir_p($upload_dir); if (!copy($file, $upload_dir . '/' . basename($file))) { $submission = WPCF7_Submission::get_instance(); $submission->set_status('mail_failed'); $submission->set_response($contact_form->message('upload_failed')); continue; } $value = $upload_url . '/' . basename($file); } // Support to Pipes $pipes = $tag->pipes; if (WPCF7_USE_PIPE && $pipes instanceof WPCF7_Pipes && !$pipes->zero()) { if (is_array($value)) { $new_value = []; foreach ($value as $v) { $new_value[] = $pipes->do_pipe(wp_unslash($v)); } $value = $new_value; } else { $value = $pipes->do_pipe(wp_unslash($value)); } } // Support to option $key = $tag->name; $webhook_key = $tag->get_option('webhook'); if (!empty($webhook_key) && !empty($webhook_key[0])) { $key = $webhook_key[0]; } $data[$key] = $value; } /** * You can filter data retrieved from Contact Form tags with 'ctz_get_data_from_contact_form' * * @param $data Array 'field => data' * @param $contact_form ContactForm obj from 'wpcf7_mail_sent' action */ return apply_filters('ctz_get_data_from_contact_form', $data, $contact_form); }
Forum: Plugins
In reply to: [CF7 to Webhook] free_text input from radio/checkbox not being sentThanks!
Forum: Plugins
In reply to: [CF7 to Webhook] free_text input from radio/checkbox not being sentThis is what I get from Zappier WebHook response:
your-name: Meghan Brewer
your-email: [email protected]
your-subject: Ut voluptatem solut
your-message: Velit ut esse fugia
radio-277: OutroThe radio-277 was selected as “Outro” with text input, but the value didn’t get there.
Forum: Plugins
In reply to: [CF7 to Webhook] free_text input from radio/checkbox not being sentYep, I’m using 2.1.4 .