eventsmanager

custom has_spaces

Sep 12th, 2013
235
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×