[Resolved] How to Custom Fiels value with Contact Form 7

This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  jensB-2 1 week, 1 day ago. The support staff assigned to this topic is Luo Yang.

Viewing 3 posts - 1 through 3 (of 3 total)
Author
Posts
#569133

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.

#569469

Luo Yang
Forum moderator

Supporter languages: English (English ) Chinese (Simplified) (简体中文 )

Supporter Timezone: Asia/Hong_Kong (GMT+08:00)

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

#569558

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"]

Viewing 3 posts - 1 through 3 (of 3 total)

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Known issues and their solutions

We document known issues and their solutions in Toolset erratas. Save time by checking there first and seeing if what you are facing is a known issue. This list is kept short. We do our best to resolve all known issues with every release of Toolset plugins.

Support Policy

Toolset staff will help you use the Toolset plugins correctly, provide any information you need, help troubleshoot problems and advice on best-practices.

Please make sure to issue only one topic per each support ticket.

For more information, read our full Customer Support Policy.

Need custom programming work for your site? Check out our certified partners.