Advertisement
eventsmanager

custom em_locations_build_sql_conditions

Jan 22nd, 2025
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. function my_build_sql_conditions( $conditions, $args ){
  2.  
  3. $events_table = EM_EVENTS_TABLE;
  4. $locations_table = EM_LOCATIONS_TABLE;
  5.  
  6. if( true == $args['eventful'] ){
  7. $conditions['eventful'] = "{$events_table}.location_id IS NOT NULL";
  8. }elseif( true == $args['eventless'] ){
  9. $conditions['eventless'] = "{$events_table}.location_id IS NULL";
  10. if( !empty($conditions['scope']) ) unset($conditions['scope']); //scope condition would render all queries return no results
  11. }
  12.  
  13. return $conditions;
  14. }
  15. add_filter( 'em_locations_build_sql_conditions', 'my_build_sql_conditions', 100, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement