Skip Navigation

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

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.
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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

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

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by jensB-2 7 years, 2 months ago.

Assisted by: Luo Yang.

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

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

The forum ‘Types Community Support’ is closed to new topics and replies.