Problem: I created a custom type named 'member' with a field named 'mail'. I want to display after the member content (of each member) a form with subject, email of the sender and body inputs. When submitting this form an email will be sent to the member using his e-mail address (field 'mail').
Solution:
- Create a new post type called "Guest Messages" or something similar. Every time someone submits the form on the front-end of the site, a new post will be created in this post type.
- Create a new custom field group that contains all the fields you want to display in the form - subject, sender email, and message. Assign this field group to the Guest Messages post type.
- Create a CRED form that creates new Guest Messages posts. Auto-generate the form code, then insert a hidden generic field. Set the value of that hidden field to be the "mail" field value of the current Member, like this:
<div style="display:none;">[cred_generic_field field='member-email' type='email' class='' urlparam=''] { "required":0, "validate_format":0, "persist":1, "default":"[wpv-post-field name='wpcf-mail' id='$current_page']" } [/cred_generic_field]</div>
- Insert any other information you want the email to include using Types and Views shortcodes.
- In the CRED notification builder, you select the generic hidden field "member-email" to be used as the "To:" destination email address. You may have to submit the form once on the front-end of the site to see your hidden field appear in the options here.
- Insert this CRED form in the Content Template or Template Layout assigned to the Members post type using the CRED forms shortcodes.
Relevant Documentation:
https://toolset.com/documentation/user-guides/#cred-topics
https://toolset.com/documentation/user-guides/inserting-generic-fields-into-forms/
https://toolset.com/documentation/user-guides/automated-email-notifications-with-cred/
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 21 replies, has 2 voices.
Last updated by 6 years, 8 months ago.
Assisted by: Christian Cox.