Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I want to filter my "events" view by those which occur today or and day after today. But when I set Event:Event Start >= now - I still get all the events old and upcoming. Help please!
Comments
Comment #1
crystaldawn CreditAttribution: crystaldawn commentedUse this instead maybe? Event: Event Start >= +1 day or Event: Event Start >= +0 day. I believe the DB abstract layer does not allow now() to be used. I dont know why but I encountered that problem in a different module once as well (queryable variables) where it wouldnt allow now() to be passed into the query. So it's probably not seeing now() as a value or just leaves it out which would result in it showing everything. This is actually a DB abstract "feature" or lack of imho. All DB's support the now syntax so I have no idea why drupal's db abstract layer doesnt allow it.
Comment #2
flippinsweet CreditAttribution: flippinsweet commentedThanks crystaldawn, but even with each of those examples I still get all the events. If you look at the query it seems to be that the numerical value for event.unix_event_start does omits time(?) as opposed to the value in the db.
Comment #3
crystaldawn CreditAttribution: crystaldawn commentedThe timestamp is a unix timestamp that can be used with views in date format yes. It shouldnt ever display the actual timestamp itself as thats just a raw value in the DB. You should always see it as a date/time lookin thing. I just tried it on my test server and it appeared to work correctly. I had 3 events, 2 in the past 1 in the future and with +1 day it showed just the future event in my view.
Here is the query that mine outputs and it works just fine:
So if your view shows something other than future events, then there is something else causing it to display everything. Compare your query with mine and look for any differences and then figure out why there is a difference.
Comment #4
flippinsweet CreditAttribution: flippinsweet commentedThanks again...here's my query:
It appears different, but I'm no expert. Thoughts?
Comment #5
crystaldawn CreditAttribution: crystaldawn commentedI dont have any idea how you got it to come up with that type of query but I would completely delete the view and start over until you get it to produce the exact same query that mine gives. It's imperative that you use +1 day so that it produces the exact same query. Then once you get it working with that, you can play with it to do other things. It's difficult to work from an unknown starting point. But if you can get it to a starting point that works then you have a base to start from. Then once you find out what was causing it to not work, then it might either be a bug or just user error.
Comment #6
flippinsweet CreditAttribution: flippinsweet commentedThanks again, I'll delete the view and start over from the top!
--Update--
I started over
I reinstalled the module
Still nothing...it appears to me that it is not pulling the "Current Date/Time" into the query
-Josh
Comment #7
crystaldawn CreditAttribution: crystaldawn commentedI am guessing that you must have some sort of other module, perhaps one that deals in date/time, thats somehow modifying the query. The only other thing I can think of is to start with a clean slate (just drupal, bare minimum views module, events, and event_views), get it working, and then enable each module one at a time to see if thats the problem. I've tried over and over to get it to produce the query you've got here but I cant lol. I'd like to find whats causing this behavior so I could write up a patch for it without writing something in the dark and just guessing. I could probably use query alter to fix it but without knowing why it happens, its likely to happen again.