daily pastebin goal
85%
SHARE
TWEET

Custom Conditional Placeholder has_attendees

eventsmanager May 22nd, 2014 328 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_action('em_event_output_condition', 'my_em_has_attendees_event_output_condition', 1, 4);
  2. function my_em_has_attendees_event_output_condition($replacement, $condition, $match, $EM_Event){
  3.         if( is_object($EM_Event) && preg_match('/^has_attendees/',$condition, $matches) ){
  4.                 if( $EM_Event->get_bookings()->get_booked_spaces() > 0 ){
  5.                         $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
  6.                 }else{
  7.                         $replacement = '';
  8.                 }
  9.         }
  10.         return $replacement;
  11. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top