Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * CHANGE field_id with your forms editor field id
- * CHANGE male or female with your own text/value eg. mr or mrs
- */
- add_action('em_event_output_condition', 'my_em_booking_meta_male_event_output_condition', 1, 4);
- function my_em_booking_meta_male_event_output_condition($replacement, $condition, $match, $EM_Event){
- if( is_object($EM_Event) && preg_match('/^is_male/',$condition, $matches) ){
- $replacement = '';
- foreach($EM_Event->get_bookings() as $EM_Booking){
- if ( $EM_Booking->booking_meta['booking']['field_id'] == 'male' ){
- $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
- }
- }
- }
- return $replacement;
- }
- add_action('em_event_output_condition', 'my_em_booking_meta_female_event_output_condition', 1, 4);
- function my_em_booking_meta_female_event_output_condition($replacement, $condition, $match, $EM_Event){
- if( is_object($EM_Event) && preg_match('/^is_female/',$condition, $matches) ){
- $replacement = '';
- foreach($EM_Event->get_bookings() as $EM_Booking){
- if ( $EM_Booking->booking_meta['booking']['field_id'] == 'female' ){
- $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
- }
- }
- }
- return $replacement;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement