Skip Navigation

[Résolu] Split: How can guest users get emailed content from a post?

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: How can guest users get emailed the content of a post?

Solution: They would need to submit a post form which has a notification that includes the post content in the notification body.

The form will need to include a field for the email address that the notification will be sent to.

If this form is shown on the post whose content is to be emailed, the post content can be inserted directly in the notification body using the wpv-post-body shortcode.

If a different post is to be sent, the form would need a selector which stored the id of the required post, so that this could be used to set the id attribute when inserting the post body in the notification.

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.

This topic contains 2 réponses, has 2 voix.

Last updated by jasonw-2 Il y a 3 années.

Assigned support staff: Nigel.

Auteur
Publications
#1100314

What I'm really wanting to do with the forms on the front end for non-logged in visitors is to be able to have them email themselves a listing. They would click on a button to bring the form up, insert their email address, and this form will email them the pictures and information from that post. Is this possible as well? I really don't want people to have to register to use the forms. There will be bounce from that, I would imagine.

Thank you again, man. I really appreciate the help.

#1100337

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

To avoid any confusion, let me be clear at the outset that a post form will publish a post. The primary purpose of the form may be to send an email (a form notification), and the generated post may be redundant if you don't want to keep a record of them, but it will get created. You may be happy manually deleting them from time to time, or set up batch jobs to clean them out (Toolset doesn't provide this), but it is something to think about.

Say you have a custom post type Articles that you want guest users to be able to request.

So you make a new post type "Requests", and add relevant custom fields (such as the guest's email address). You will also need to add a custom field which we will use to store the ID of the source article, which we will need in the notifications (so that we can send content from the article where the request was made rather than content from the request itself).

You make a form to "publish" requests which includes these fields (but which probably won't include post title, possibly not post content, unless you want the guest to include a message in their request).

For the id field you will automatically set its value to the current article, like so:

[cred_field field="source-id" force_type="field" class="form-control" output="bootstrap" value="[wpv-post-id]"]

You'll want to use CSS to hide it so that it is not visible in the form on the front end.

Now create your notification, which you will want to send when the form is submitted, and to send to the email address provided in the form field.

In the notification itself you can use standard Views shortcodes to output the title, the content etc., and you specify that these should be the title of the Article and not the request by providing an id attribute, the value of which comes from the hidden field you included in the form, something like this:

<p>source post title is [wpv-post-title id="[types field='source-id' output='raw'][/types]"]</p>

Is that all clear enough?

#1101736

Sounds perfect.

I will be trying to implement / create this in the next week or so. Seems like it's pretty straight up and I'll give it my best shot.

Thank you very much for taking the time to explain this. I will let you know how it goes. 🙂