Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function em_mod_offline_conditional($replacement, $condition, $match, $EM_Event){
- if (is_object($EM_Event)) {
- switch ($condition) {
- case 'has_offline':
- $count_offline = 0;
- foreach($EM_Event->get_bookings() as $EM_Booking){
- $current_booking_id = $EM_Booking->output('#_BOOKINGID');
- if ( $EM_Booking->booking_meta['gateway'] == 'offline' && $current_booking_id == $EM_Booking->booking_id ){
- $count_offline++;
- }
- }
- if ( $count_offline > 0 ){
- $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
- }else{
- $replacement = '';
- }
- break;
- }
- }
- return $replacement;
- }
- add_filter('em_event_output_condition', 'em_mod_offline_conditional', 10, 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement