When I call eo_insert_event() and the dates are different (so I’m adding a 3 day event that does not repeat), only the first day of the event is displayed on the calendar page. Not all 3 days.
But when I edit it and re-save it without changing anything, it appears correctly in the calendar.
What am I missing? I am using the sample from http://codex.wp-event-organiser.com/function-eo_insert_event.html
$new_event = array();
$new_event['schedule'] = 'once';
$new_event['frequency'] = 1;
$new_event['start'] = new DateTime( $event_start, eo_get_blog_timezone() );
$new_event['end'] = new DateTime( $event_end, eo_get_blog_timezone() );
$new_event['all_day'] = $event_allday;
$post_id = eo_insert_event( $new_post, $new_event );

Dave Navarro
What values are you using for $event_start
and $event_end
. The following created an all-day, 3-day event from the 11th March through to the 13th:
$event_start = '2016-03-11 00:00';
$event_end = '2016-03-13 23:59';
$new_event = array();
$new_event['schedule'] = 'once';
$new_event['frequency'] = 1;
$new_event['start'] = new DateTime( $event_start, eo_get_blog_timezone() );
$new_event['end'] = new DateTime( $event_end, eo_get_blog_timezone() );
$new_event['all_day'] = true;
$post_id = eo_insert_event( array( 'post_title' => 'Test event' ), $new_event );

Stephen Harris
I am pulling it from a form:
$event_start = $_POST['item_meta'][346];
$event_end = $_POST['item_meta'][348];
if ( $event_allday ) {
$event_start .= ' 00:00:00';
$event_end .= ' 00:00:00';
} else {
$event_start .= ' ' . $_POST['item_meta'][349];
$event_end .= ' ' . $_POST['item_meta'][350];
}
I’m guessing that the end time should not match the start time… That’s the only difference I see between your code and mine.

Dave Navarro
The time per-se doesn’t matter, though it should be 23:59 for all-day events as otherwise the event will be one-day shorter than intended.
I’m more interested in the value of $event_start
and $event_end
: when that script runs what is an example actual vale are they given (it will oibviously depend on user input).

Stephen Harris