Advertisement
eventsmanager

custom has_spaces

Sep 12th, 2013
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. /*
  2. This snippet will serve as an additional example for creating conditional placeholder
  3. since we already have this conditional by default.
  4. */
  5. add_filter('em_events_get_default_search','my_em_get_default_search_has_spaces',1,2);
  6. function my_em_get_default_search_has_spaces($searches, $array){
  7. if( !empty($array['has_spaces']) && is_numeric($array['has_spaces']) ){
  8. $searches['has_spaces'] = $array['has_spaces'];
  9. }
  10. return $searches;
  11. }
  12.  
  13. add_filter('em_events_get','my_em_events_get_has_spaces',1,2);
  14. function my_em_events_get_has_spaces($events, $args){
  15. if( !empty($args['has_spaces']) && is_numeric($args['has_spaces']) ){
  16. foreach($events as $event_key => $EM_Event){
  17. if( $EM_Event->event_rsvp && $EM_Event->get_bookings()->get_available_spaces() < 1 ){
  18. unset($events[$event_key]);
  19. }
  20. }
  21. }
  22. return $events;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement