<?php
function em_event_output_show_condition( $show, $condition, $full_match, $EM_Event ){
switch ($condition) {
case 'waitlist_open' :
$is_fully_booked = $EM_Event->get_bookings()->get_available_spaces() <= 0;
$is_waitlists_limit = get_option('dbem_waitlists_limit');
if( !empty($EM_Event->event_attributes['waitlist_limit']) ){
$is_waitlists_limit= $EM_Event->event_attributes['waitlist_limit'];
}
$is_waitlist_enable = get_option('dbem_waitlists');
if( !empty($EM_Event->event_attributes['waitlist']) ){
$is_waitlist_enable = $EM_Event->event_attributes['waitlist'];
}
$show = $is_waitlist_enable && $is_fully_booked && $is_waitlists_limit;
break;
}
return $show;
}
add_filter('em_event_output_show_condition', 'em_event_output_show_condition', 100, 4);
Comments