* 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
  * @package glmMembersDatabaseEventsAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.6.92
+ * @version 1.6.93
  */
 
 // Check that we're being called by WordPress.
  *  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.
 
     public function getModelEventsData( $categoryId = null, $limit = null, $memberId = null, $amenityId = null, $venueId = null, $cityId = null, $isNameSearch = false )
     {
 
+        // echo '<pre>$cityId: ' . print_r( $cityId, true ) . '</pre>';
         $this->postAddTimes = true;
         $whereParts = array();
         $where = $order = '';
         }
 
         // 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 '<pre>$cityId: ' . print_r( $cityId, true ) . '</pre>';
+            $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}
+            )
+            )
             )";
         }