• Hi Stephen,

    A small help required. M using Version 1.4.2 of event organiser. I require the following all events which start before today or start today and all events that end after today or today and of a paticular category.

    Here is my code
    $events = eo_get_events(array(
    ‘showpastevents’=>true,
    ‘event_start_before’ => $_REQUEST[“eventon”],
    ‘event_end_after’ => $_REQUEST[“eventon”],
    ‘ondate’ => $_REQUEST[“eventon”],
    ‘group_events_by’ => ‘series’,
    ‘tax_query’=>array(
    array(
    ‘taxonomy’ => ‘event-category’,
    ‘operator’ => ‘IN’,
    ‘field’ => ‘slug’,
    ‘terms’ => $_REQUEST[“slug”]
    )
    )
    ));

    this return all events where $_REQUEST[“eventon”] is the date and $_REQUEST[“slug”] is the category

    $events = eo_get_events(array(
    ‘showpastevents’=>true,
    ‘event_start_before’ => date(‘Y-m-d’),
    ‘event_end_after’ => date(‘Y-m-d’),
    ‘ondate’ => date(‘Y-m-d’),
    ‘orderby’ => ‘eventstart’,
    ‘order’ => ‘DESC’,
    ‘group_events_by’ => ‘series’,
    ‘tax_query’=>array(
    array(
    ‘taxonomy’ => ‘event-category’,
    ‘operator’ => ‘IN’,
    ‘field’ => ‘slug’,
    ‘terms’ => get_query_var(‘term’)
    )
    )
    ));

    this shows me events that start from today :O .

    Also if there is a event that reoccurs between 1st to 30th of a month weekly on thursday then both of the above fetches the event for all days ??

    I know im doing smthing wrong plz throw some light
    Plz help i have a deadline ??

    Aalok Dhond

    https://www.ads-software.com/extend/plugins/event-organiser/

Viewing 1 replies (of 1 total)
  • Hi Aalok,

    I would remove the ondate parameter.

    event_start_before etc are inclusive dates – so your second query for instance would fetch events that start on or before AND end on or after today (and also belong to some term). In effect this should return any events that are ‘running’.

    Also if there is a event that reoccurs between 1st to 30th of a month weekly on thursday then both of the above fetches the event for all days ??

    With 'group_events_by' => 'series' then no, this should’t be happening.

    I’ve tested the above query (without the taxonomy part) and it works fine for me (this was using 1.5.7 – but I’m not aware of anything that would mean it shouldn’t work in 1.4.2). That said, I’d recommend upgrading to the latest version anyway.

    If the problem persists it could be due to another plug-in/theme (you can check this by disabling other plug-ins and switching to twenty eleven). There are other debugging steps you can take:

    • Check the $_REQUEST values are being recieved
    • Check the SQL statement by placing var_dump($where) just above this line. Feel free to post it here.

    One thing that is odd is that you’re two examples are not consistent. On the first you get all events, on the second you get events that start after today… If $_REQUEST['eventon'] is set to today then these queries should be the same, no?

Viewing 1 replies (of 1 total)
  • The topic ‘Queries’ is closed to new replies.