db03
Forum Replies Created
-
Forum: Plugins
In reply to: [CF7 to Airtable] Help! Data is not being recorded in Airtable.I found this function in the entry.php file:
function save_wpcf7_entry_in_airtable_table( $contact_form, &$abort, $submission ) { $service = WPCF7_Airtable_Service::get_instance(); if ( ! $service->is_active() ) { return; } if ( $contact_form->in_demo_mode() ) { return; } $consented = true; $optional_consent_tag = false; foreach ( $contact_form->scan_form_tags( 'feature=name-attr' ) as $tag ) { if ( $tag->has_option( 'consent_for:airtable' ) ) { if ( $tag->has_option( 'optional' ) ) { $optional_consent_tag = $tag; } if ( null === $submission->get_posted_data( $tag->name ) ) { $consented = false; } break; } }…
if (is_wp_error($response) || $response->error) { $error_message = $response->message; // Display error $submission_response = __("Due to an error, your message could not be sent. Please try again later.", 'add-on-cf7-for-airtable'); // If there is an optional consent tag, let the user know he can uncheck it. if ( $optional_consent_tag ) { /* translators: %s: consent checkbox text */ $submission_response= sprintf( __("Due to an error, your message could not be sent. Please try again later or uncheck.", 'add-on-cf7-for-airtable'), $optional_consent_tag->content); } $submission->set_response($submission_response);Is it related to the $optional_consent_tag? If so, where do i add it or better where to remove it?
Forum: Plugins
In reply to: [CF7 to Airtable] Help! Data is not being recorded in Airtable.@wpconnectco, where can I send the screenshots? Do you have an email address?
Forum: Plugins
In reply to: [CF7 to Airtable] Help! Data is not being recorded in Airtable.I encountered an issue while using Contact Form 7 (CF7) with your plugin. I noticed a fundamental difference in how CF7 fields are handled. I use the Dynamic Text Extension (DTX) for my form, which may be causing compatibility issues with your plugin.
To troubleshoot, I first tried using regular CF7 field types with the “class=hidden” attribute, along with a custom function to populate these fields before sending the email. However, this approach did not resolve the issue. I then tested with a simple, regular CF7 form, but the problem persisted.
Interestingly, I also noticed an error message that I did not configure in the message tab. This raises questions about the source of the error. Do I need to configure an SMTP server for your plugin to work properly? I recall testing this a few months ago without any special configurations, and it worked fine.
I would appreciate any guidance or documentation you can provide to help me resolve this issue. Thank you for your assistance.
Hi,
You’re probably right about the error message—thank you for your response.
Even though I’ve uninstalled Youzify from my site, the database still contains the 7
wp_youzify_*tables and potentially entries in other tables. Is this a bug, or do I need to manually sweep the database?Thank you for your assistance.
Thank you for the responses!
I have worked around by using $_POST variable instead of $posted_data. It was way simpler for me since I only needed the key to be stored in the database.
I really appreciate your support
here is the code, sorry!
add_action( 'wpcf7_before_send_mail', 'switch_options_key_value' ); function switch_options_key_value( $contact_form ) { $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $posted_data = $submission->get_posted_data(); //var_dump($posted_data); if ( isset( $posted_data['boutique_en_ligne'] ) ) { $selected_key = $posted_data['boutique_en_ligne']; $options = get_your_options_array( $posted_data ); if ( $options !== false ) { $flipped_options = array_flip( $options ); if ( isset( $flipped_options[ $selected_key ] ) ) { $selected_value = $flipped_options[ $selected_key ]; // Save the selected value to user meta update_user_meta( get_current_user_id(), 'boutique_en_ligne', $selected_value ); } else { error_log( 'Selected key not found in options array' ); } } else { error_log( 'Error parsing options array' ); } } else { error_log( 'boutique_en_ligne field not found in posted data' ); } } else { error_log( 'Submission instance not found' ); } } function get_your_options_array( $posted_data ) { $dynamic_options = array(); if ( isset( $posted_data['boutique_en_ligne'] ) ) { if ( is_array( $posted_data['boutique_en_ligne'] ) ) { $field_value = implode(',', $posted_data['boutique_en_ligne']); } else { $field_value = $posted_data['boutique_en_ligne']; } error_log( 'Field value before explode: ' . $field_value ); $pairs = explode( ',', $field_value ); error_log( 'Pairs after explode: ' . print_r( $pairs, true ) ); foreach ( $pairs as $pair ) { $parts = explode( ':', $pair ); if ( count( $parts ) == 2 ) { $dynamic_options[ $parts[0] ] = $parts[1]; } else { error_log( 'Error parsing pair: ' . $pair ); return false; // Error parsing options array } } } else { return false; // boutique_en_ligne field not found } return $dynamic_options; }Thank you for your time. I’ve tried several different approaches, but I can’t seem to get it to work! Could you provide more detailed guidance? I’ve attempted to use
add_shortcode,add_action, andadd_filter, but I’m unsure of where to trigger them since my form is only intended to update user meta values andskip_mailis enabled.i have tried this and yet no result, it seems no key|value pair is sent only the value:
I would appreciate any assistance you can provide.
Thank you.
- This reply was modified 2 years, 1 month ago by db03. Reason: didnt paste the right code
YES! thank you very much for your support
Thank you very much for your response!
I understand you are busy. Would it be too optimistic to expect a resolution sometime next week? I have plenty to work on in the meantime, especially since I am fairly new to WordPress programming.
Thank you in advance.
The issue I’m facing is that I can’t set more than one default option. The CF7 documentation suggests that I should be able to specify multiple defaults by separating them with underscores, but this doesn’t seem to work with dynamic checkboxes.
I’d appreciate any help or suggestions on how to resolve this. Thank you.
I was continuing my research and it looks like a could make my custom shortcode to get the data I need. Where can i write the code so its safe from future updates?
Thanks. that would certainly help!