Skip Navigation

[Resolved] Dynamically populating the from field of a mail notification with a customfield

This thread is resolved. Here is a description of the problem and solution.

Problem:

I have a post called 'Venues'
Venues has a custom field called contact-email - this is separate field from the authors user_email

I want to create a form on this page which is visible only to logged in users which has a text box for a message that will be sent to contact-email.

I assume I would create custom post type called 'messages' or something to the form actually creates this and then sends the notification on.

contact-email is dynamic as every venue could have a different one - I seem to be able to send the notifcation to a designated email address, the logged in user or a designated user but not to a value of a custom field.

Solution:

It is possible with Toolset Forms plugin, see details here:

https://toolset.com/forums/topic/dynamically-populating-the-from-field-of-a-mail-notification-with-a-customfield/#post-1210397

Relevant Documentation:

https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

This topic contains 4 replies, has 2 voices.

Last updated by casparK 5 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1210216

I have a post called 'Venues'
Venues has a custom field called contact-email - this is separate field from the authors user_email

I want to create a form on this page which is visible only to logged in users which has a text box for a message that will be sent to contact-email.

I assume I would create custom post type called 'messages' or something to the form actually creates this and then sends the notification on.

contact-email is dynamic as every venue could have a different one - I seem to be able to send the notifcation to a designated email address, the logged in user or a designated user but not to a value of a custom field.

Any thought on how to do this - I have some some success with Contact form 7 and the dynamic text extension but prefer for this to be all in Toolset

Any ideas?

#1210397

Hello,

I think it is possible with Toolset Forms plugin.

For example, you can try these:
1) Create a post type "message",
2) setup one-to-many relationship between post types "Venues" and "message"
3) create a custom email field "send-to" in post type "message"
4) create a post form for creating "message" post, put the custom email field "send-to" into the form content, and populate the default value with "contact-email" field value:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
value. Optional. Preset value

For example:

[cred_field field='send-to' force_type='field' class='form-control' output='bootstrap' value='[types field='contact-email' output='raw' id='$current_page'][/types]']

5) Then you will be able to send to the email address value of field "send-to", see our document:
https://toolset.com/documentation/user-guides/automated-email-notifications-with-cred/#send-different-notifications-to-the-site-admin-and-visitor
section "Send different notifications to the site admin and visitor"
screenshot:
hidden link

6) The put above post form into single "Venues" post content, and test again.

#1210842

Hi Luo

Thats really clever thanks- I think it is going to work!

#1210933

You are welcome

#1211558