Skip Navigation

[Resolved] Dates failing to be set and filtered

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

This topic contains 2 replies, has 2 voices.

Last updated by nekuda-gilads 4 years, 5 months ago.

Assisted by: Nigel.

Author
Posts
#1750067

Hello, I have a view which I need to display events and the query should include only events that have an end date (costume field) greater than today.
also, I need a filter for the start and end date fields which I have set and worked correctly but I can't add a secondary filter for the same field. so I can't filter out events that already have ended and have a manual filter.
I tried to remove the manual filter and only display events greater than today but it failed to filter them out.
I have tried using a number as the type and an unsigned like suggested here https://toolset.com/forums/topic/query-filters-arent-working-as-expected/
but it did not work.
Another problem is that if I go to an event and try to modify the start or end date field I get a js error.
SyntaxError: Unexpected token o in JSON at position 1.

#1753817

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

Sorry for the delay getting back to you, there was quite a backlog of tickets after the weekend.

It's not possible to have both a backend Query Filter (which operates on every page load) and also front-end search filter for the same field that temporarily overrides it.

At least it is not possible to add such conditions using the UI.

You effectively need a default value for the filter (i.e. later than today) which is applied if no front-end filter is set.

For that you can use the API, specifically the wpv_filter_query hook to check whether there is an existing filter value for the custom field and if not apply one.

See https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

If that is not something you are comfortable with I can help you, though it will be tomorrow.

Your other problem with the JSON error, do you mean when you are editing the post in the backend?

I'd need access to your site to be able to take a look, but before that, can you check whether you still see the problem when all non-Toolset plugins are deactivated and after switching theme to twentytwenty? There may be a conflict with code from another vendor.

Finally, it would help if you could include your debug info in your next reply: hidden link

#1761899

Thanks for the reply,
So I looked at the code and it seems that there was a filter set for filtering only future events.

https://toolset.com/forums/topic/parametric-search-default-date-toady/
this was a thread that the programmer that build the site had open for this.
so the issue is resolved and somehow the js error went away as well.
Thanks