I have a page created through a post form. When a user fills out the form, the user creates the page. Thats okay.
Now I want to include a contact button that takes visitors to a single form.
In this form, the system will take the user's data from the previous page, and will send the form.
example:
When pressing the contact button, you would need the form to send the information to the email of the user who created the page (post author).
How do you think we can do this?
I think that using a single form for all users and maybe form can receive the email post author vía jquery or something like that.
Now when the user clicks on the Click Me link they will be sent to the form page with a url parameter called contact_id that has the ID of the post they are coming from.
From there on your form you can retrieve any field value from the previously clicked post by setting the default value of your form fields to [types field="my-field" item="[wpv-search-term param='contact_id']"]
Where my-field is the slug of the field that I would like to get.
I think that '/?contact_id=1346' it works because 1346 is the id of the origina page.
But now, i created a new form on the second page and contact id not appear on my frontend form, the value is empty. How i can add that data (author email for example) to email notification?
I tried but i dont know how it works. i attached you a screenshoot of the set up form.
It is okay?
I'm assuming that the author email is stored on the Post in a custom field? or is it stored on the user who created the post?
From your screenshot I noticed that you are just using [wpv-post-id] to add a value to the field, however this won't work because the [wpv-post-id] will always get the current ID of the page that it is on and not the ID that is being passed in the URL.
To get the id in the URL you will need to use this shortcode.
[wpv-search-term param='contact_id']
To use this ID to get a custom field's value you will need to do this below.
Okay. Now it's working perfect! But i attached how it shows and i cant move to another position of the page. Its possible to move below or apply a display none?
Now, i would adding the email to notification email when form is submit and publish a page with the info added.
i think that i know how to publish the info but i dont know how to add the author email to email notification
In order to send the email in the notification you need to add it to the form itself.
You will need to add my custom shortcode to the message to field as its value. See your screenshot.
This will pass the email into the form and then you can just retrieve this field in the email notification. I'm assuming that you want the email to be added to the Message To: field.
The field value is the first option. See my screenshot . Where it says "set a default value for this field".
Now in this area you are going to add the custom shortcode i've created [cust_get_author_meta post_id='[wpv-search-term param="contact_id"]']
Once you've done this the email should show up in this field. If you are still having challenges you can provide me with admin access and I can set this up for you.