Hi guys,
I have a website, where visitors can subscribe to seminars with a Contact Form 7 form. Though I´m using just one form for all seminars, I want to send the location and date via a custom field.
So I have created the custom fields "Location" and "Date" with Types (slugs are: "location" and "date").
I´ve tried two plugins for sending custom fields and a tutorial from CF7 itself but none of this methods send the custom field values with the email.
Any suggestions, what can I do?
This is the code from the CF7 site and should place the value of the custom field "location" into a text input:
[text* your-name default:get default:post_meta "location"]
Here will only appear "location" instead of the value.
This is the method of using the Contact Form 7 Modules (https://wordpress.org/plugins/contact-form-7-modules/) extension:
[hidden hidden-948 "custom_field-location"]
Here no value or text at all will be sent.
This is the method of using Contact Form 7 Dynamic Text Extension (https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/)
[dynamictext dynamictext-945 "CF7_get_custom_field key='location'"]
Here no value or text at all will be sent, too.
I hope you can help me with this problem.
Thanks in advance.
Dear Jens,
For your question:
I´ve tried two plugins for sending custom fields and a tutorial from CF7 itself but none of this methods send the custom field values with the email.
It depends on the CF7 plugin, it is CF7 plugin who sending the data and store the data, it is out the range of Toolset support, I suggest you contact it with CF7 plugin supporters.
In Types plugin, when you create a custom field with Types plugin, for example the field slug is "my-field", Types plugin will add "wpcf-" prefix before the field slug, so in wordpress database, table "wp_postmeta", the column meta key is "wpcf-my-field".
And you can try with the wordpress built-in action hook save_post, like this:
1) When user submit the CF7 form, create/edit a post, use action hook save_post to trigger a custom PHP function
2) In this PHP function, get the field value submit from CF7 form, and save it to the custom field you want.
See wordpress document:
https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
For your reference
Thank you very much for your help.
I wasn´t aware that Type puts a prefix before the custom field´s slug.
That shortcode for CF7 Modules fixed the problem:
[hidden hidden-948 "wpcf-location"]