From 4b79cf099ad6fee5bae86602355d9c34a7e07e5d Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 14 Aug 2018 16:17:06 -0400 Subject: [PATCH] Updating city search for events. When searching city id need to check if the use_member_location is set. Else need to check for the member info city. --- index.php | 6 +++--- models/front/events/baseAction.php | 25 +++++++++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/index.php b/index.php index 8d842bf..c96393d 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ * Plugin Name: GLM Members Database Events * Plugin URI: http://www.gaslightmedia.com/ * Description: Gaslight Media Members Database. - * Version: 1.6.92 + * Version: 1.6.93 * Author: Chuck Scott * Author URI: http://www.gaslightmedia.com/ * License: GPL2 @@ -19,7 +19,7 @@ * @package glmMembersDatabaseEventsAddOn * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @version 1.6.92 + * @version 1.6.93 */ // Check that we're being called by WordPress. @@ -43,7 +43,7 @@ if (!defined('ABSPATH')) { * so that we're sure the other add-ons see an up to date * version from this plugin. */ -define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.92'); +define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.93'); define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.6'); // This is the minimum version of the GLM Members DB plugin require for this plugin. diff --git a/models/front/events/baseAction.php b/models/front/events/baseAction.php index f07795a..4cb5d4a 100644 --- a/models/front/events/baseAction.php +++ b/models/front/events/baseAction.php @@ -202,6 +202,7 @@ abstract class GlmMembersFront_events_baseAction extends GlmDataEvents public function getModelEventsData( $categoryId = null, $limit = null, $memberId = null, $amenityId = null, $venueId = null, $cityId = null, $isNameSearch = false ) { + // echo '
$cityId: ' . print_r( $cityId, true ) . '
'; $this->postAddTimes = true; $whereParts = array(); $where = $order = ''; @@ -226,18 +227,26 @@ abstract class GlmMembersFront_events_baseAction extends GlmDataEvents } // check for city id in event list search - if ( $cityId = filter_var( $cityId, FILTER_VALIDATE_INT ) && !$isNameSearch ) { - $whereParts[] = " + if ( ( $cityId = filter_var( $cityId, FILTER_VALIDATE_INT ) ) && !$isNameSearch ) { + // echo '
$cityId: ' . print_r( $cityId, true ) . '
'; + $whereParts[] = "( + (T.use_member_location <> true + AND T.id IN ( SELECT event FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "locations WHERE city = {$cityId} - AND event IN ( - SELECT event - FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times AS ET - WHERE status = " . $this->config['status_numb']['Active'] . " - AND " . $this->dateRange . " - ) + )) + OR ( + T.use_member_location = true + AND + T.ref_dest IN ( + SELECT member + FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info + WHERE status = 10 + AND city = {$cityId} + ) + ) )"; } -- 2.17.1