eo_get_events doesn't seem to filter any events by date

WordPress Event Management, Calendars & Registration Forums General Question eo_get_events doesn't seem to filter any events by date

This topic contains 4 replies, has 2 voices, and was last updated by  Stephen Harris 7 years, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2990

    Hello everyone,

    I’m using the Event Organiser 1.6.3 on WordPress 3.4. I’ve inserted a couple of test-events and I’m trying to display them, month by month, by using the eo_get_events(), but the function doesn’t seem to filter anything – it always returns all events, the recurring ones as well. This is a test script for the events in September 2013, which is a month with no events in it (I didn’t insert any, the Calendar View doesn’t show any):

    $events = eo_get_events(array(
    ‘events_start_after’=>’2013-09-01’,
    ‘events_start_before’=>’2013-09-30’,
    ‘showpastevents’ => ‘false’));
    var_dump($events);

    The $events has array has 20 elements (actually, no matter which month I “filter”, I always get 20 elements), and the startdate is definitely outside September:

    array(20) {
    [0]=>
    object(stdClass)#711 (31) {
    ["event_id"]=>
    string(2) "56"
    ["occurrence_id"]=>
    string(2) "56"
    ["StartDate"]=>
    string(10) "2013-01-20"
    ["StartTime"]=>
    string(8) "10:00:00"
    ["EndDate"]=>
    string(10) "2013-01-20"
    ["FinishTime"]=>
    string(8) "12:00:00"
    ["event_occurrence"]=>
    string(1) "3"
    ...
    [5]=>
    object(stdClass)#786 (31) {
    ["event_id"]=>
    string(2) "62"
    ["occurrence_id"]=>
    string(2) "62"
    ["StartDate"]=>
    string(10) "2013-01-31"
    ["StartTime"]=>
    string(8) "19:00:00"
    ["EndDate"]=>
    string(10) "2013-02-02"
    ["FinishTime"]=>
    string(8) "16:00:00"
    ["event_occurrence"]=>
    string(1) "0"
    ["ID"]=>
    int(1522)
    ...

    and so on. Any idea what am I doing wrong?

    Thanks,
    Andre

    andrei
    #2991

    Hi Andrei,

    The parameters are event_* (no ‘s’).

    (Though maybe I should introduce those as aliases – since with an ‘s’ makes more sense semantically)

    Stephen Harris
    #2992

    Was your usage based on an example you found in the documentation? If so I’d better update it!

    Stephen Harris
    #3000

    Hey Stephen,

    thanks for the fast reply! That was the problem indeed, it works after using event_ instead of events_. Great plugin, by the way!! 🙂

    Some examples in the documentation are using events_, e.g. on these sites:

    http://wp-event-organiser.com/documentation/function/eo_get_events/

    http://wp-event-organiser.com/documentation/function/eo_get_the_end/

    https://gist.github.com/4165380

    Thanks for the great work,
    Andrei

    andrei
    #3003

    Thanks Andrei!

    I’ll update those and keep an eye out for any other mistakes like that. It looks like the same example which I’ve copied around, so hopefully that’s all of them.

    Stephen Harris
Viewing 5 posts - 1 through 5 (of 5 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.