[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.

Our next available supporter will answer your ticket in about 7.22 hours from now. Thank you for your understanding.

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  jensB-2 2 months 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)