• Using Events Manager 5.6.6.1 on WordPress 4.6.1.

    I am trying to import events from another site. I can wp_remote_get that page and parse it.
    Now I want to get the events for a specific location and see if I need to add new events.
    I would like a PHP array so that I can easily loop through each event for comparison.

    $args = array('location'=>586, 'format'=>'', 'format_header'=>'', 'format_footer'=>'');
    $venue_events = em_get_events( $args, true );
    var_dump( $venue_events );

    The venue id is from the url when I edit that venue.
    Currently returning “No Events” but the venue does have an event on December 7:
    https://www.corkentertainment.ie/venues/reardens-bar/

    I tried adding ‘array’=>1 to $args but that gives a fatal error:
    PHP Fatal error: Call to a member function output() on a non-object in //wp-content/plugins/events-manager/classes/em-events.php on line 195

    I’ve read em-events.php but I cannot see how it should work. I don’t see where the database query is being done.

Viewing 1 replies (of 1 total)
  • Thread Starter daymobrew

    (@daymobrew)

    I did get further by changing the location ID to 74 (I found that ID in the EM_LOCATIONS table). With that working I changed the ‘format’ to one that would be easy for me to parse.

    $args = array('location'=>74, 'scope'=>'future', 'format'=>"#_EVENTNAME|#_{Y-m-d}|#_EVENTTIMES\n", 'format_header'=>null, 'format_footer'=>null);
    $venue_events = em_get_events( $args, true );
    var_dump( $venue_events );

    This does give me a string that I can parse (explode by “\n” and then by “|”) but an actual PHP list would be better.

    The ‘array’=>1 argument still breaks things – either it is not supposed to work or is broken.
    I think that the EM_Events::output() function should check that $EM_Event is an object before calling line 195:
    $output .= $EM_Event->output($format);

Viewing 1 replies (of 1 total)
  • The topic ‘How do I use em_get_events() to get list for one venue’ is closed to new replies.