[Gelöst] Create Contact Form with Variable Recipient E-Mail Address
This support ticket is created vor 3 Jahre, 4 Monate. 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.
I have a custom post type called "Positions" that includes name, e-mail address, etc. I would like to create a form that sends an e-mail to the e-mail address in the Position post type. To do this, I created a second post type called "Messages" but cannot figure out how to pass the e-mail address from the Position into the recipient field of the form. Here is the shortcode that contains the e-mail address:
In the attached screenshot, you can see what I am attempting to do, but it does not work. Is there a better way to accomplish this? I prefer whatever solution we use to avoid making the e-mail address visible in the HTML code on the front end. Thanks in advance for any help
Hello, unfortunately the "To" field in the notification settings will not support shortcodes, so you'll need a different approach. If you don't want to include the email address directly in the Form field values, the most viable solution here is to use the Forms notification API cred_notification_recipients to programmatically assign notification recipients on-the-fly: https://toolset.com/documentation/programmer-reference/cred-api/#cred_notification_recipients
I can help you set up any Toolset APIs you need help with, just let me know if you get stuck somewhere or if you don't have experience with custom code.
Thanks for the response. I had not set up the Messages post type as a child of Positions, but I can see the logic in doing so. Can you tell me if it is possible to hide the Messages children from the edit Position screen in the admin page? I'd prefer people using the system not have visibility to all messages related to a Position.
Yes, that is possible if you use Toolset Access to restrict permissions to the Message post type for specific User roles. This may also remove the Message post type menu item for those Users. So it depends on how strictly you want to enforce this in wp-admin.
Sorry for not responding. We had a major snowstorm and have been snowed in for a couple days. Just replying to keep this topic open. Thanks again for your help and I'll pick this back up in the next couple days!
The code you referenced worked beautifully for sending to the e-mail address associated with the parent post type. Can you refresh my memory on how to use a form field to set the "from" name and e-mail address? Thanks - hope you have a great holiday weekend.
Hello Aaron, Christian is on vacation for a couple of days, I'll try my best to help based on what understood.
However, for support rules, we are able to handle only one issue at a time. This helps us to bring you a better service and also helps other users to find all the information here exposed. If you would need further assistance with my suggestion below, please open a new ticket.