Home › Toolset Professional Support › [Resolved] Can we send an email without creating a "Message"
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Tagged: Classifieds reference, Reference sites
This topic contains 3 replies, has 2 voices.
Last updated by Nigel 6 years, 7 months ago.
Assisted by: Nigel.
It seems like overkill to create saved message threads.
Maybe we just want to have a simple functionality where potential buyers can
a) look at the sellers Ads
b) click "Contact Seller" which opens up a form
c) complete a simple form that sends an email to the seller (of course we'd like a reference to the Ad listing included by default).
As it stands, every time somebody sends a message to the seller, a new "subscriber" account is created for that person.
Seems unnecessary and over time will just clog up the database.
How can we do this more simply?
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi there
I don't know the rationale for setting up the reference site such that visitors who want to contact sellers have subscriber accounts created, but there is no reason in principle why you cannot create a contact form that guest visitors can submit.
But that still involves creating a post, because that's what CRED forms do, create a message post that is used to trigger the email.
There isn't any way in Toolset to send an email without creating a post (or user) to trigger the message.
So you can create a CRED form for guest users that doesn't imply creating new users but does mean creating a post that serves the purpose of recording the attempt to contact the seller.
If you really didn't want to accumulate such posts in the database, you could use the cred_save_data hook which is triggered immediately after the post has been saved to straight away delete it.
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
https://codex.wordpress.org/Function_Reference/wp_delete_post
So you can create a CRED form for guest users that doesn't imply creating new users but does mean creating a post that serves the purpose of recording the attempt to contact the seller.
OK. So as a first step, how would I go about doing that?
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
I'm guessing you have the reference site to refer to for how the existing form works, to know how to set the recipient email address which would be the advertiser, for example. (I don't have a reference site set up currently to check, but I can create one if needs be.)
On my local test site I just created a post type "Contact logs" which are the posts that will be created when a user contacts someone via the site.
I then made a CRED post form to publish Contact logs, setting the status as draft (they don't need to be published) and displaying a "Message sent!" message upon submission.
I included an email field for the recipient in the form, which I then used when setting up a notification for when the form was submitted.
In the message body I included the post body field from the form using the wpv-post-body shortcode. Note that you may find you need to explicitly set the id for fields used in notifications, like so:
[wpv-post-body view_template="None" id="%%POST_ID%%"]
I can go ahead and insert this form, or a link to it, wherever I want it to appear.
Now the final part is to go to Toolset > Access Control > CRED Forms and set the permissions for the form so that guest users can see and submit it.
That's basically it. I have glossed over the less pertinent details as I assume you are familiar with creating CRED forms, but if not please check the documentation, and then come back to me if there is something specific you are not sure about.
https://toolset.com/documentation/user-guides/creating-cred-forms/