diff --git a/includes/event-organiser-event-functions.php b/includes/event-organiser-event-functions.php index e401c047..4fe0d009 100644 --- a/includes/event-organiser-event-functions.php +++ b/includes/event-organiser-event-functions.php @@ -310,8 +310,12 @@ function eo_get_the_occurrence( $event_id, $occurrence_id ) { * @param int $occurrence_id The occurrence ID * @return string the start date formated to given format, as accepted by PHP date */ -function eo_get_the_occurrence_start($format='d-m-Y',$occurrence_id){ +function eo_get_the_occurrence_start($format='d-m-Y', $occurrence_id = 0){ global $wpdb; + + if( empty( $occurrence_id ) ) { + return false; + } $querystr = $wpdb->prepare(" SELECT StartDate,StartTime FROM {$wpdb->eo_events} @@ -320,13 +324,15 @@ function eo_get_the_occurrence_start($format='d-m-Y',$occurrence_id){ $occurrence = $wpdb->get_row($querystr); - if( !$occurrence ) + if( !$occurrence ) { return false; + } $date = trim($occurrence->StartDate).' '.trim($occurrence->StartTime); - if(empty($date)||$date==" ") + if(empty($date)||$date==" ") { return false; + } return eo_format_date($date,$format); }