Skip to content

Commit

Permalink
fix PHP8 Deprecated: Required parameter follows optional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauri Kallioniemi committed Oct 4, 2021
1 parent a48945b commit 2a99535
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions includes/event-organiser-event-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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);
}
Expand Down

0 comments on commit 2a99535

Please sign in to comment.