get_tribe_events() – start_date and end_date not working

Home Forums Calendar Products Events Calendar PRO get_tribe_events() – start_date and end_date not working

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #27224
    Cheryl
    Participant

    Thanks for the reply.

    I changed the display type to ‘all’ and got the same result. I removed the dates altogether, and got the same results.

    When I used the WP_Query class, and used the meta_query parameter in the arguments to compare the _EventStartDate and _EventEndDate fields against my input dates, I noticed by dumping the contents of the resulting object that the query was using current date to select events instead of my input dates in the query.

    This is how I did the meta parameter piece:
    ‘meta_query’ => array(
    ‘relation’ => ‘AND’,
    array(
    ‘key’ => ‘_EventEndDate’,
    ‘value’ => $startdate,
    ‘compare’ => ‘>=’,
    ),
    array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => $enddate,
    ‘compare’ => ‘<=',
    ),
    where $startdate and $enddate are in Y-m-d H:i:s format.

    By using the WP_Query class, without any meta parameters, I can get all of the events from today onward and then filter those with additional code to select the date range required. However, I noticed when I examined the object that the query has injected some selection criteria which excludes events that have the "hide from upcoming" meta data, even though I didn't specify anything about that in my query parameters. I would like to get all published events in the range for this query.

    So, that's where I'm at.

    #27225
    Barry
    Member

    Right, I mean this query http://pastebin.com/6Md4TGfH works for me, and returns events within the specified date range and within the specified category. Events that have been hidden from the upcoming events list are also returned.

    I’m not really sure why this isn’t working in your case, it’s difficult to fully assess without knowing the context in which it is being called etc.

    #27261
    Cheryl
    Participant

    OK, things have improved. I am getting the ‘hidden’ upcoming events when I use the tribe_get_events function, but I am missing one event that has a custom recurrence. It recurs weekly on Tuesday – Saturday ending on 2012-11-30 and looks like this in the _EventRecurrence field on the database:

    a:13:{s:4:”type”;s:6:”Custom”;s:8:”end-type”;s:2:”On”;s:3:”end”;s:10:”2012-11-30″;s:9:”end-count”;s:1:”1″;s:11:”custom-type”;s:6:”Weekly”;s:15:”custom-interval”;s:1:”1″;s:16:”custom-type-text”;s:11:”Week(s) on:”;s:21:”occurrence-count-text”;s:5:”event”;s:15:”custom-week-day”;a:5:{i:0;s:1:”2″;i:1;s:1:”3″;i:2;s:1:”4″;i:3;s:1:”5″;i:4;s:1:”6″;}s:19:”custom-month-number”;s:5:”First”;s:16:”custom-month-day”;s:1:”1″;s:24:”custom-year-month-number”;s:1:”1″;s:21:”custom-year-month-day”;s:1:”1″;}

    My search is for today thru 2012-11-18. I do get this one with the WP_Query but not the tribe_get_events.

    #27267
    Leah
    Member

    Hey Cheryl,

    I just wanted to let you know that we are closing up support for the weekend, as usual. We appreciate your patience, and I’ll make sure Barry is back in touch with you on Monday.

    Cheers,
    Leah

    #27314
    Barry
    Member

    Hi Cheryl, that’s not a problem I can replicate.

    • I set up a recurring event running weekly from Oct 1 to Nov 30
    • I created a query using tribe_get_events() with the date range Nov 1 to Nov 18
    • Any of the recurring events within that timespan were returned as expected

    So I’m not sure why you aren’t experiencing that, things to check:

    • That all of the events are still in the same recurring pattern (if you have edited any single instances then it’s possible the chain of events may have been split apart)
    • If you are using a taxonomy query then double check that those events are assigned to the relevant category

    Thanks!

    #27352
    Cheryl
    Participant

    Hi Barry,
    Thanks for your continued attention to this. Everything is working fine today. Go figure! I’m not sure what changed, but I’ll take it!

    Thanks again!

    #27353
    Barry
    Member

    Great, in that case I will go ahead and close this topic 🙂

Viewing 7 posts - 16 through 22 (of 22 total)
  • The topic ‘get_tribe_events() – start_date and end_date not working’ is closed to new replies.