1

I have created a views field using the Views PHP module. This field converts a text date string into a date stamp, and now I need to create an exposed filter for organising the rows.

I add a filter "Global: Combine fields filter", and under "CHOOSE FIELDS TO COMBINE FOR FILTERING" I select Global:PHP to select my field, but the filter doesn't work, I just get the following error...

SQLSTATE[42000]: Syntax error or access violation: 1064 
You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax 
to use near ') LIKE '2014-01-03') ))) subquery' at line 4

I need to create an exposed grouped filter for "Todays events", "Tomorrows events", "upcoming events". Is it possible to create a filter for a field rendered by views PHP?

I have searched loads of similar questions, but they have all gone unanswered. Can anyone help?

2

If you are using Views PHP, then you are using it's alpha or development version. Alpha tests means that maintainer expects there to be bugs and want you to report them in issue queue. Development version almost certainly have issues, that's the nature of ongoing development.

Having that said, you shouldn't attempt to use exposed filters on fields that are not in database, and cannot be readily joined and used in SQL WHERE with your data. Unless, of course, module that provides it already implemented it properly, and it appears it is not the case here. So your options are:

  1. Forget Views PHP for dates, and use regular Date to get date fields attached to your entities, and Date views submodule for views exposed filters, or

  2. Post a bugreport and wait for it to be fixed. Just don't really expect it to happen, as module currently lacks manpower and is seeking co-maintainers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.