// Get all regions from the location table.
// This will not get those events with members that are in a region.
$regions = $this->wpdb->get_results(
- "SELECT id,name
- FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "regions
- WHERE id IN (
- SELECT region
- FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "locations
- WHERE event IN (
- SELECT event
- FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
- WHERE active
- AND DATE(start_time) >= '%s'
- )
- )
- ORDER BY name",
+ $this->wpdb->prepare(
+ "SELECT id,name
+ FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "regions
+ WHERE id IN (
+ SELECT region
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "locations
+ WHERE event IN (
+ SELECT event
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
+ WHERE active
+ AND DATE(start_time) >= '%s'
+ )
+ )
+ ORDER BY name",
+ $from
+ ),
ARRAY_A
);
return $regions;
// Get all categories from the location table.
// This will not get those events with members that are in a region.
$categories = $this->wpdb->get_results(
- "SELECT id,name
- FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "categories
- WHERE id IN (
- SELECT category
- FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "event_categories
- WHERE event IN (
- SELECT event
- FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
- WHERE active
- AND DATE(start_time) >= '%s'
- )
- )
- ORDER BY name",
+ $this->wpdb->prepare(
+ "SELECT id,name
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "categories
+ WHERE id IN (
+ SELECT category
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "event_categories
+ WHERE event IN (
+ SELECT event
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
+ WHERE active
+ AND DATE(start_time) >= '%s'
+ )
+ )
+ ORDER BY name",
+ $from
+ ),
ARRAY_A
);
return $categories;