Problem:
Can CRED send a Email to the author of the Post where the CRED form is inserted to (not the post edited) with the data of the user clicking/submitting the form?
Solution:
Create a Cred Form that holds only one generic Form Field (see below), and the Submit Button and the mandatory CRED Fields.
The CRED Form must hold a Generic Field, hidden, of type email.
You can hide it with
field here
The Form creates a Post of Type "your-choice"
Do not include a Title Field, or somehow with CRED API populate this Title with a value, or CRED will create a AutoGenerated Draft.
Add a Notification to the CRED form that "Sends notification to an email specified in a form field:
"above created CRED generic Hidden Field"
Apply a
action to the CRED Form, which grabs the Email of the author of the Post wher you insert the CRED form.
To access this Post Object, you use
$form_data['container_id']
(to get the data of the Post where the CRED is inserted to.)
You get it's author and then that authors Email.
This is done with WordPress API.
Then, once you have above infos, you update your CRED Generic Field with the
function (still in your CRED
function)
Then submitting the form will send the email to the author of the post wher the CRED is inserted to.
Relevant Documentation:
https://toolset.com/documentation/user-guides/creating-cred-forms/
http://codex.wordpress.org/Function_Reference/get_post_field
https://codex.wordpress.org/Function_Reference/get_userdata