From: Steve Sutton Date: Tue, 8 Jan 2019 20:12:05 +0000 (-0500) Subject: Add from date to query X-Git-Tag: v1.7.14^2~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=3f4d0a90c18015245bf2474691d3118a8ee15288;p=WP-Plugins%2Fglm-member-db-events.git Add from date to query Setup prepare for the from date --- diff --git a/setup/frontHooks.php b/setup/frontHooks.php index 950b339..91dc123 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -271,19 +271,22 @@ add_filter( 'glm-member-db-events-get-region-search', function() { // 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; @@ -296,19 +299,22 @@ add_filter( 'glm-member-db-events-get-category-search', function() { // 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;