Skip Navigation

[Closed] view filter no longer working

This support ticket is created 2 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.

Our next available supporter will start replying to tickets in about 0.32 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 20 replies, has 3 voices.

Last updated by Luo Yang 2 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2286173

I have a view that is using this filter:

Team Color is a string different from VIEW_PARAM(notteam)

On the page where I am showing the view, I am calling it like this:
{!{wpv-view name='15mm-schedule-actor-conflict-sheet' notteam='BLUE' cached='off'}!}

This view has worked for several years - and generally returns all posts which say "RED" or "N/A" or "Both" or anything but "BLUE" in the field "Team Color".

Suddenly now, the view is NOT working and is returning:
NO ITEMS FOUND

I KNOW that there are items that match the parameters. If I remove this filter, the view works fine and returns items with all kinds of things in the field "Team Color" - including "RED", "BLUE", and "N/A".

Do have any idea why this view would suddenly not be working?

(by the way - I have no idea why the shortcode parameter is called "notteam" - that is something the Toolset creates when I set up the View parameters)

#2286489

Hello,

How do you setup the custom field "Team Color"? is it a custom radio field or checkboxes field?
You can share your website credentials in below private message box, also point out the problem page URL and view URL, I need to test and debug it in a live website, thanks

#2286563

Thanks for the details, please check these:
1) Edit the post view "15MM Schedule Actor Conflict Sheet":
hidden link
It is querying posts of post type "Locations"

2) Edit the field group "Core Assignment Months", it is assigned to another post type "Events"

So you will get the result: NO ITEMS FOUND

You can not filter the post view by fields of another post type.

#2286921

Thanks for your work, but I think you'll find that it is querying "Locations" AND "Events" ... and if you don't use a filter, the query works just fine.
Just to be sure, I removed "Locations" so it is now ONLY querying "Events" - and it still doesn't work.

#2287325

For the new question Just to be sure, I removed "Locations" so it is now ONLY querying "Events" - and it still doesn't work.

I have tried these in your website:
1) Create a new post view
hidden link
- Query "Events" posts
- Filter by:
Select items with field:
Team Color is a string different from VIEW_PARAM(notteam)

2) Create a new page, display above view's shortcode:

notteam='BLUE'
[wpv-view name='view-filter-no-longer-working' notteam='BLUE' cached='off']
<hr />
notteam='RED'
[wpv-view name='view-filter-no-longer-working' notteam='RED' cached='off']
<hr />

Test it in frontend:
hidden link

So there should be other filter problem in your post view "15MM Schedule Actor Conflict Sheet", you need to check the other filters one by one, make sure they are setup correctly.

#2287553

Something has suddenly gone horribly wrong with all of the views on the page that we've been talking about.

They all use a version of the filter:
_event_start_date is a DATE greater than or equal TODAY()

This filter has been working for years - and was working when I started looking at it this evening.
Now suddenly it is NOT working and it is showing events from the past for all of my views.

Could there be some reason that when I open up a view to look at it and save it - something changes that breaks the view?

Why else would a view that was working earlier this evening would suddenly stop working?

I'm really confused about what is going on!!!

Elise

#2287555

I just checked several other pages that use this same filter to show only events in the future - and suddenly NONE of them are working!

#2287575

Sorry for my mistake, in order to debug this issue, I had changed your theme file functions.php, line 398 from:
add_filter('wpv_filter_custom_field_filter_processed_value', 'format_event_start_date_comparison', 10, 3);

To:
//add_filter('wpv_filter_custom_field_filter_processed_value', 'format_event_start_date_comparison', 10, 3);

And just restore it back, please check the new problem is fixed, thanks

For the original issue, please provide a copy of your website in below private message box, I need to test and debug it in my localhost without breaking your production website, thanks

#2287953

Yes, thanks - that fixed it (thanks because I have a lot of views that use that special function!)

I have created a page that has an identical view without the shortcode parameter filter - but it has all the other filters - and it works just fine - so I don't see what could be wrong with the other filters. As soon as I add the Team Color parameter, the view returns NO ITEMS FOUND.

The new page I made is:
hidden link

So all of those other filters work fine as long as the Team Color filter isn't added.

Do you think it has something to do with that code you had commented out that allows the view to process the _event_start_date and _event_end_date filters properly? That code was given to me by somebody at Toolset years ago to help Views interface with the Events Manager plugin with handles date fields differently.

Here is that code:

//allows a specific View to filter the Events Manager START date field properly

add_filter('wpv_filter_custom_field_filter_processed_value', 'format_event_start_date_comparison', 10, 3);
function format_event_start_date_comparison($value, $key, $view_id)
{
if (in_array($view_id, array(15587, 15984, 16005, 16088, 16095, 16367, 16406, 16608, 16610, 16663, 16665, 16669, 16765, 16671, 16678, 16679, 17793, 18300, 18316, 18362, 18300, 18370, 18373, 18377, 18414, 18418, 18621, 18626, 19766, 29544, 29905, 30202, 30210, 30361, 31627, 31631, 31670, 31681, 31682, 33150, 33303, 33304, 39292, 39498, 45847, 45851, 48043, 50156, 51420, 52888, 53199, 53433, 53444, 53445, 53446, 54574, 53199, 56940, 71221, 71232, 73252, 74065, 76063, 80182, 90024, 92608, 100739, 100741, 100821, 100940, 120080)) && $key == '_event_start_date')
{
return date('Y-m-d', $value);
}
return $value;
}

//allows a specific View to filter the Events Manager END date field properly

add_filter('wpv_filter_custom_field_filter_processed_value', 'format_event_end_date_comparison', 10, 3);
function format_event_end_date_comparison($value, $key, $view_id)
{
if (in_array($view_id, array(15587, 15984, 16005, 16088, 16095, 16367, 16406, 16608, 16610, 16663, 16665, 16669, 16765, 16671, 16678, 16679, 17793, 18300, 18316, 18362, 18300, 18370, 18373, 18377, 18414, 18418, 18621, 18626, 19766, 29544, 29905, 30202, 30210, 30361, 31627, 31631, 31670, 31681, 31682, 33150, 33303, 33304, 39292, 39498, 45847, 45851, 48043, 50156, 51420, 52888, 53199, 53433, 53444, 53445, 53446, 54574, 53199, 56940, 71221, 71232, 73252, 74065, 76063, 80182, 90024, 92608, 100739, 100741, 100821, 100940, 120080)) && $key == '_event_end_date')
{
return date('Y-m-d', $value);
}
return $value;
}

#2288367

Since your website is very complicated with lots of custom codes, in order to debug the problem, please provide a copy of your website in below private message box, I need to test and debug it in my localhost without breaking your production website, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2291429

I am downloading the files, will update here if find anything

#2293803

I have tried the duplicator package in my localhost, it keeps redirect me to your nmi.org, so I have to remove all other plugins/theme, but when I edit the post view "15MM Schedule Actor Conflict Sheet Test" again, I don't see the post type "Locations" in section "Content Selection", how do you setup the post type "Locations"? with other plugins? if it is, which plugin should be activated?

#2294483

You actually don't need that post type ... if you untick it and just use "Events" post type, the view works.

I should untick that, but I haven't found it makes a different whether I have it on or off since the view isn't actually accessing anything from that post type (but it is a sub-post type of "Events" and is from the Events Manager plugin)

#2295247

It should be a compatibility issue of your website, I have tried these with your duplicator package:
1) Deactivate all other plugins, switch to wordpress default theme 2022
2) duplicate post view "15MM Schedule Actor Conflict Sheet Test" to "15MM Schedule Actor Conflict Sheet Test 2"
3) Edit the new post view "15MM Schedule Actor Conflict Sheet Test 2", add the custom field filter:
Team Color is a string different from VIEW_PARAM(notteam)
Remove those two custom date field filters:
- _event_start_date
- _event_end_date
4) Create a new page, and display above post view with shortcode:
{!{wpv-view name='15mm-schedule-actor-conflict-sheet-test-2' notteam='BLUE' cached='off'}!}

It works fine in frontend. So it should be some conflicts in your website, might be related with the custom codes you mentioned above in post:
https://toolset.com/forums/topic/view-filter-no-longer-working/#post-2287953

Can you confirm it in you website? thanks

#2295685

I know that it works without the custom date filters - but I need it to work WITH them (like it used to).

If you remove the date filter, then the view will return everything in my calendar going back several years. The date filter is what gets the view to show only what is from this date forward (and only up until September).

I need to figure out why it stopped working with the custom date filter - when it has been working for several years.

The topic ‘[Closed] view filter no longer working’ is closed to new replies.