Advertisement
Guest User

Events Manager Scope - Future with time filter

a guest
Feb 13th, 2013
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. add_filter( 'em_get_scopes','my_em_scopes_modfuture',1,1);
  2. function my_em_scopes_modfuture($scopes){
  3. $my_scopes = array(
  4. 'future-mod' => 'Modified Future'
  5. );
  6. return $scopes + $my_scopes;
  7. }
  8.  
  9. add_filter( 'em_events_build_sql_conditions', 'my_em_scope_conditions',1,2);
  10. function my_em_scope_conditions($conditions, $args){
  11. if( !empty($args['scope']) && $args['scope']=='future-mod' ){
  12. $start_date = date('Y-m-d',current_time('timestamp'));
  13. $start_time = date('H:i:s',current_time('timestamp'));
  14. $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) ";
  15. }
  16. return $conditions;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement