Skip Navigation

[Resolved] Automatically change custom post type status with authorization link in email

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to allow guests to publish posts after verifying their email. Can I use Toolset to send an automated notification containing a link that will automatically change their post status?

Solution: The only built-in way to change a post's status from the front-end of the site is to use a Form. It cannot be submitted via email, but you could send a link to that Form via email.

This support ticket is created 4 years, 9 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)

Author
Posts
#1276809

I am trying to: More of a question, really - would it be possible to automatically change custom post type status from an authorization link in an email without requiring the user to login first?

1. User visits site and uses a frontend form to submit a free custom post type listing without having to register
2. User then receives an automated email that includes a link to authorize the listing on the site
3. When the users clicks on the link, it runs a script that converts the post status from pending/draft status to active/published status.

Is this possible with the current Toolset modules available?

Link to a page where the issue can be seen: In idea stage right now...

I expected to see: NA

Instead, I got: NA

#1276823

No, there's nothing exactly like this built in to Toolset. It would require custom code. The only way Toolset allows to change a post status from the front-end of the site is using a Form, which must be submitted on site, not via emailed link. You might be able to link to a custom Page on the site using a special URL parameter, and allow the User to click a button like "Publish Now" which would submit a Form that changes the post status.

1. User visits site and uses a frontend form to submit a free custom post type listing without having to register
2. User then receives an automated email that includes a link to authorize the listing on the site

So the User must submit their email address somehow. Is that in the Form where they create a post, or somewhere else? I'm trying to understand how the automated email would work, and whether you plan to accomplish this with Toolset or some other 3rd party system.

#1276835

Hi Christian - you're correct, the user would submit their email address in the same form they use to supply the post data, which would then trigger the automatic email notification - which Toolset forms allows. So you think the automated reply could include a link to a another "confirmation" form on a custom page, and that when the user submits the form, it could change the post status? I think this would be doable.

Another question. Would it be possible to use a similar process to send another automatic notification after let's say 7 days after the post status changed to published using the above described process, and that message is a confirmation email that they want to keep their listing, but when they click on the confirmation button this time, it changes their custom post type from one type to another custom post type - if I have two levels of custom post types? Can a new form be used to automatically pulls the data from an existing listing and convert it to a new custom post type listing, and automatically set the status to published for a set number of day?

Thanks!

#1276853

So you think the automated reply could include a link to a another "confirmation" form on a custom page, and that when the user submits the form, it could change the post status? I think this would be doable.
Yes, this is essentially what I had in mind. Security isn't very tight here, because you would essentially be passing URL parameters around that correspond to post IDs. Anyone could manually change the post ID and publish someone else's post. If security is a priority here, then you're going to need more custom code that relies on less "guessable" information. Here's what I mean. To understand which post is going to be published, we would add a URL parameter like this to the link:

<em><u>hidden link</u></em>

Anyone could manually change 12345 and publish some other post.

Can a new form be used to automatically pulls the data from an existing listing and convert it to a new custom post type listing, and automatically set the status to published for a set number of day?
The notification is possible, and modifying post status and expiration can be achieved as well. However, Forms are not designed to help you convert between post types. That part is mostly outside the scope of Toolset and would require custom code. Depending on the custom fields, taxonomy terms, post relationships, and so forth established in the first post type, it might be quite difficult to do this well. Could this "extra level" post be designated with a custom field or taxonomy instead?

#1276905

Hmm - you got me thinking. Maybe I don't need two different post types if the free version is just missing some of the features of the premium level post type, which would mean that after a set number of days, some of the features/fields would disappear from the listing by being hidden, unless the user wants to change it back to a premium listing - in which case they would need to contact me and I can do that manually after payment is received. Is this doable with the current Toolset modules?

I'm not that concerned about the security at this level, especially since the confirmation/publish link is sent to the email used in the original form the user submitted, and at this stage they are initiating a free listing that will hopefully convert to a paid level after 7 days if they choose to pay for one - in which I would be using a different process to collect payment and manually changing the post status once I receive payment. Plus, if I see it's being abused, then I can tackle making it less guessable.

#1276919

Yes I agree if you remove the need for completely different post types, you could accomplish this more easily with Toolset components. If you're not familiar with conditional HTML, check out this document: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
You can use conditional HTML to show or hide different features on the front-end of the site depending on some custom field value, or some taxonomy term, etc.

I also recommend checking out automatic post expiration with Forms, to see what is possible:
https://toolset.com/documentation/user-guides/automatic-post-expiration/

#1276927

Cool! I'll be sure to read up on the documentation you recommend. Thanks for your help and suggestions - always excellent!

#1276929

Thanks - great suggestions and support ... as always!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.