Missing conditional place holder for attendees
-
I am looking for conditional placeholder
has_attendees, but surprisingly there seems not to be such a placeholder.So I tried to make my own condtional placeholder based on the suggestion done here: https://ww.wp.xz.cn/support/topic/field-for-organizer. Unfortunate my code isn’t working. No matter the event has attendees or not the outcome is always true. This is my code:
add_filter('em_event_output_show_condition', 'my_em_has_attendees', 1, 4);
/* Whether to display the event format content between {has_attendees}the content{/has_attendees} */
function my_em_has_attendees($show, $condition, $full_match, $EM_Event)
{
if ('has_attendees' == $condition) {
$EM_Bookings = $EM_Event->get_bookings();
$EM_MyCountBookings = 0;
foreach ($EM_Bookings as $EM_Booking) {
if ($EM_Booking->booking_status == 1) {
$EM_MyCountBookings += 1;
}
}
if ($EM_MyCountBookings > 0) {
$show = true;
}
}
return $show;
}What did I do wrong?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Missing conditional place holder for attendees’ is closed to new replies.