eventsmanager

Modified Future Scope

Feb 19th, 2013
499
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. This snippet includes time when filtering events
  3. - Paste this in your theme functions.php
  4. */
  5.  
  6. add_filter( 'em_get_scopes','my_em_scopes_modfuture',1,1);
  7. function my_em_scopes_modfuture($scopes){
  8. $my_scopes = array(
  9. 'future-mod' => 'Modified Future'
  10. );
  11. return $scopes + $my_scopes;
  12. }
  13.  
  14. add_filter( 'em_events_build_sql_conditions', 'my_em_scope_conditions',1,2);
  15. function my_em_scope_conditions($conditions, $args){
  16. if( !empty($args['scope']) && $args['scope']=='future-mod' ){
  17. $start_date = date('Y-m-d',current_time('timestamp'));
  18. $start_time = date('H:i:s',current_time('timestamp'));
  19. $conditions['scope'] = " (event_end_date >= CAST('$start_date' AS DATE) AND event_start_time > CAST('$start_time' AS TIME) AND event_end_date != '0000-00-00' AND event_end_date IS NOT NULL) ";
  20. }
  21. return $conditions;
  22. }
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.

×