eventsmanager icon

custom em_locations_build_sql_conditions

eventsmanager | PRO | 01/22/25 05:35:27 AM UTC | 0 ⭐ | 282 👁️ | Never ⏰ | []
text |

620 B

|

None

|

0 👍

/

0 👎

function my_build_sql_conditions( $conditions, $args ){
     $events_table = EM_EVENTS_TABLE;
    $locations_table = EM_LOCATIONS_TABLE;
     if( true == $args['eventful'] ){
        $conditions['eventful'] = "{$events_table}.location_id IS NOT NULL";
    }elseif( true == $args['eventless'] ){
        $conditions['eventless'] = "{$events_table}.location_id IS NULL";
        if( !empty($conditions['scope']) ) unset($conditions['scope']); //scope condition would render all queries return no results
    }
     return $conditions;
}
add_filter( 'em_locations_build_sql_conditions', 'my_build_sql_conditions', 100, 2 );

Comments