Skip Navigation

[Resolved] Allow users to "save" view filter criteria & receive email alert if new match

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

This topic contains 4 replies, has 2 voices.

Last updated by Don 3 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#2083195

Don

Tell us what you are trying to do?

I am wanting to allow users to receive reminders for new posts that match what they are looking for. Basically the equivalent of a "filtered view" which is saved (for example in their profile/account) as a "saved search" and, via cron, they will an email alert when NEW posts matching the filter criteria are posted, which will prompt them to visit the site again to view the new post/listing. Again, this is specifically for registered front-end users, NOT for me as admin. Are all the refinements (filter selections of a view) saved (or at least available to be saved) as a complete url for example, which could be used to achieve this? If not i think it would be a great new addition, allowing users to save a search and get automatic alerts of new matches rather than, when they think about it and go through the whole process of logging in to filter a view once again from scratch in the hopes that "maybe" now there will be new matches......

If not something that could be achieved using the built in toolset view and its filtering powers, any suggestions for another way to go about it? I didnt see any 3rd party plugins that would actually filter posts based on custom field values and send notifications, as opposed to notifications regarding post updates/status changes, but also nothing geared towards front end users instead of admins..... i hope i can offer this functionality to my users!

#2083605

Hello, I think it's a great idea but unfortunately there is nothing exactly like this built-in to the Toolset suite. It sounds like an excellent candidate for a custom code solution, as there are some limitations in Toolset that present problems that are not easily overcome with the built-in features. I think you would encounter all of these limitations, at the very least:

- No arbitrary cron/scheduler interface. There are no cron or scheduler options built-in to Toolset that would enable periodic automated email notifications at arbitrary intervals. Toolset's email notification scheduler is currently built around a Forms-based workflow. Email notifications are created and attached to a specific Form, and triggered on a schedule directly linked to those Form submissions. It sounds like you might need a way to create and trigger email notifications on an arbitrary schedule, like once a day/week/month or something similar, but that infrastructure does not currently exist. Instead, this email notification schedule would have to be based on when new posts are submitted via Forms. Posts that are imported or created in wp-admin would not trigger these email notifications, and furthermore I suspect clients would prefer the ability to choose the frequency of those updates, and unsubscribe to specific saved search notifications (CAN-SPAM compliance), so I suspect a more arbitrary schedule system is preferred. It would also need the ability to send or not send notifications based on arbitrary programmatic conditionals. This needs a fully custom solution, not easily achieved with built-in features.

- No built-in method to save custom searches or search parameters. There is no built-in workflow for saving search criteria or search URLs, so you would need to implement something custom like a set of custom fields (repeatable field group or RFG) or custom post type corresponding to a saved search. A repeatable field group or separate custom post type would be useful in this case, so you could save multiple instances of subscriptions along with the various field options or search URL, along with a search "name" for future reference, perhaps a field indicating the desired schedule/frequency, the date the last search results were captured for comparison, the results from that date, and other relevant information for each subscription. RFGs are not supported in User profiles, nor are post relationships, so I suspect a separate custom post type is required here.

- No built-in method for comparing sets of search results. Since the key criteria for sending these notifications would be a comparison of search results over time, you'd need a way to save not only the search criteria but also the results from a previous query. We have a PHP API you can use to get search results, so a custom solution here might rely on that API for performing
a search, gathering the results, comparing the current results with a set of previous results from a custom field somewhere, and saving the new results into that custom field for future comparisons.
https://toolset.com/documentation/programmer-reference/views-api/#get_view_query_results

You can see that it's a fairly involved feature with several aspects that are not easily achieved in the current system using built-in functionality. I did a quick search in our internal tracker for feature requests, and a search of the forums for similar requests, but didn't find anything like what you've described here in a previous feature request. I saw a couple of tickets with similar questions over the last few years, but there does not appear to be a large enough number of requests to get our developers to prioritize this feature. I suspect the developers would consider this a low priority if submitted as a feature request, given the amount of new development required to implement this entire feature. That request would likely sit in our development queue for quite some time given the number of higher priority requests, so I suggest reaching out to an independent contractor if you'd like to get this implemented in a timely manner.

#2083627

Don

thank you so much, once again, for the incredible amount of consideration, and time, you put into my support ticket..... respect! Even if the answer is not what i "hope" for, it is explained very well and helps to weight the options. I wasn't necessarily hoping to find a solution "contained" within toolset per se, ie i would expect the cron to be a custom one set to run a script that does the comparing.... my hope was that, at least with specific pre-requisites, it would be possible for a person to choose to "save" a specific search, ie they have filtered a view down to the results they would be interested in, and that this combination of filters could be compared as a combination of terms for (new) posts that match each and every filter value specified).... for example, i have noticed that if i choose to use a full page refresh after submit on a collection of view filters, all filters, regardless of whether they had values entered or not, are appended into the url.... so i had hoped that the "skeleton" is there. And i had hoped that if a cron ran a script that checked this exact url structure that they choose to "save" as a saved search, and compare the results to the LAST time the url was run, that it would return basically whats "new" and could send an email alert with links to the "new" listings"..... if that makes sense. so basically the part specific to toolset is how limited in scope would this be (in my experiment here i am not using any taxonomies, just custom fields) and, since it only looks like the url "updates" with the search query if ajax is not used, if THAT is also a condition to it possibly working or whether the same info is basically "there" even if ajax is used to update rather than page refresh.... i am hoping that based on my naive experiment, IF that finalized filtered view url could be used like this, then a custom plugin that saves this "search" in the user profile, and would use a cron to do as i described above..... i cant do it myself but if it looks like that "should Work" as i describe, at least i can save time and money on development steering a programmer in this direction rather than looking to figure out a solution from scratch.....

#2083733

Sure, I think it's definitely possible with custom code given the limitations I've explained. A skilled PHP developer with WordPress and Toolset experience could create a plugin that provides these features for you in a custom solution using our APIs along with WordPress functionality. A couple of resources for finding independent contractors, if you need one:
https://toolset.com/contractors
https://codeable.io/developers/toolset/

#2083773

Don

My issue is resolved now. Thank you!