eventsmanager

Custom conditional placeholder {waitlist_open}

Jul 8th, 2025
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. function em_event_output_show_condition( $show, $condition, $full_match, $EM_Event ){
  5.  
  6. switch ($condition) {
  7.  
  8. case 'waitlist_open' :
  9.  
  10. $is_fully_booked = $EM_Event->get_bookings()->get_available_spaces() <= 0;
  11. $is_waitlists_limit = get_option('dbem_waitlists_limit');
  12.  
  13. if( !empty($EM_Event->event_attributes['waitlist_limit']) ){
  14. $is_waitlists_limit= $EM_Event->event_attributes['waitlist_limit'];
  15. }
  16.  
  17. $is_waitlist_enable = get_option('dbem_waitlists');
  18. if( !empty($EM_Event->event_attributes['waitlist']) ){
  19. $is_waitlist_enable = $EM_Event->event_attributes['waitlist'];
  20. }
  21.  
  22. $show = $is_waitlist_enable && $is_fully_booked && $is_waitlists_limit;
  23.  
  24. break;
  25.  
  26. }
  27.  
  28. return $show;
  29. }
  30. add_filter('em_event_output_show_condition', 'em_event_output_show_condition', 100, 4);
Advertisement
Add Comment
Please, Sign In to add comment