Skip Navigation

[Resolved] How to send an email to an address defined as a custom field of a CPT

This support ticket is created 5 years, 8 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by PaulS4783 5 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1215362

I am using the Classifieds starter site.
I want visitors to be able to send an email to the owner of a car listed for sale.
hidden link
By default, the "Contact Owner" button creates a new CPT post called "Message"
I want to avoid this for two reasons:
a) It seems like overkill to create a database post entry just for sending a message
b) It seems like ToolSet is not going to support the starter site frameworks into the future
Therefore anything that is not part of the "default" ToolSet architecture will be deprecated.

With CRED is it possible to alter the Custom Post Type "Listings" such that when a form is completed it appends the message details to the Listing record as Custom Fields "Buyer Email", "Buyer Name" & "Buyer Message" (not visible to anyone though). Ideally I would like to keep ALL these records but maybe that would be too problematic. So even if it gets overwritten so that only the MOST RECENT entry is saved, that might work.

#1216632

Hi, the short answer is that I can't recommend making any modifications to the Classified site's existing functionality. The code for that plugin was not written in a way that is easily extended or customized. It's intended to be used as a reference so you can see a complex system, and how custom code can be used to create webapps with Toolset. Changing how the message posts are created and stored represents a major infrastructure difference, so you would have to do some serious code refactoring. I would not try this, even if I were a skilled developer. I would examine the code to see how it works, and use that information to build a custom system of my own. Otherwise, you will eventually run into major headaches if you try to extend this codebase.

#1216661

The issue of the deprecated "Classifieds Extension Plugin" has already been discussed in another ticket.
https://toolset.com/forums/topic/warning-illegal-string-offset-get/


Q. I've had a quick look at the Classifed Extension plugin code.
From what I can gather it looks like the extension adds two things.
- Messaging functionality
- Managing "Ad Packages"

Is there anything else that the Extension plugin brings to the project?

If it's just those two things we might be able to disable the Extension plugin
and use a different 3rd party plugin solution (or write a custom plugin ourself).

A. Those are the two features that the plugin adds, yes.
If you disable the plugin you should be able to verify that the other features work as expected.

So what I am asking about is a way to use the native ToolSet plugins to achieve a similar outcome for the messaging functionality. The challenge is how to extract the "contact email" custom field from the Listing Post and use it in a "Contact Seller" email form.

The options seem to be:
a) Somehow use CRED
b) Use a 3rd party form plugin like Gravity (with ToolSet connections?)
c) Write a custom plugin

Please advise on the best solution.

#1217055

The challenge is how to extract the "contact email" custom field from the Listing Post and use it in a "Contact Seller" email form.
Let's assume you have placed a contact form of some kind on a single Listing post page. In that form, you would like to access a custom field value from the current single Listing post. You can do that with the Types field shortcode and the "id" attribute, using the $current_page operator to specify which post you want to look in:

Email from current Listing post: [types field='your-field-slug' id='$current_page'][/types]

You could pass that information into a field in the form, then capture that value and do something with it in the backend. Toolset offers generic fields that you can use for this purpose. Those input field values are available in a cred_save_data hook if you want to use PHP to do something with those values.

#1217345

OK thanks.
I am going to try a different approach to this.
cheers.