Completed work on permitting separating sections for glm-members-list shortcode feature/ajaxSearch
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 24 Jan 2019 20:43:40 +0000 (15:43 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 24 Jan 2019 20:43:40 +0000 (15:43 -0500)
Optimized processing to prevent duplicate work for multiple section.
Updated glm-member-list shortcode attributes list.
Cleared up various undefined parameter issues.

models/front/members/list.php
setup/shortcodes.php
views/front/members/list.html
views/front/members/listTypeList.html

index 1bb46ab..a25611e 100755 (executable)
@@ -41,11 +41,15 @@ $GLOBALS['showOpts'] = array(
     'search-text'           => 'list_show_search_text',
     'search-categories'     => 'list_show_search_category',
     'search-amenities'      => 'list_show_search_amenities',
+    'search-region'         => 'list_show_search_region',
     'search-alpha'          => 'list_show_search_alpha',
+    'search-city'           => 'list_show_search_city',
+    'search-floating'       => 'list_floating_search',
     'list'                  => 'list_show_list',
     'name-link'             => 'list_show_detail_link',
     'logo'                  => 'list_show_logo',
     'logo-filler'           => 'list_show_logo_filler',
+    'logo-for-mobile'       => 'list_logo_for_mobile',
     'address'               => 'list_show_address',
     'street'                => 'list_show_street',
     'city-state-zip'        => 'list_show_citystatezip',
@@ -58,9 +62,11 @@ $GLOBALS['showOpts'] = array(
     'url'                   => 'list_show_url',
     'url-new-target'        => 'list_show_url_newtarget',
     'email'                 => 'list_show_email',
-    'categories'            => 'list_show_categroies',
+    'categories'            => 'list_show_categories',
     'credit-cards'          => 'list_show_creditcards',
     'amenities'             => 'list_show_amenities',
+    'logo-filler'           => 'list_show_logo_filler',
+    'live-cam'              => 'list_show_live_cam',
     'packages'              => 'list_show_packages',
     'packages-link'         => 'list_show_packages_link'
 );
@@ -156,53 +162,88 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
             $membStartTime = microtime(true);
         }
 
-        // Enqueue the Marker Clusterer Script
-        wp_register_script(
-            'glm-members-admin-google-maps-marker-clusterer',
-            GLM_MEMBERS_PLUGIN_URL . 'js/googleMapsMarkerClusterer/markerclustererplus.js',
-            array(
-                    'jquery'
-            ),
-            GLM_MEMBERS_PLUGIN_VERSION
+        /*
+         * Now that we can have multiple calls to the [glm-members-list] shortcode, we need
+         * to avoid doing duplicate work or sending duplicate content to output.
+         *
+         * First we have to determine if this model has been called for the current user
+         * page instance, keep track of what work has been performed, and avoid doing
+         * redundant queries. The "$thisIntance" static variable below will be sent the
+         * first time this model is called on the page and will retain any data needed
+         * to avoid redundant work.
+         *
+         */
+
+        static $thisInstance = array(
+            'instanceCount'      => 0,
+            'searchDisplayed'    => false,
+            'mapDisplayed'       => false,
+            'listDisplayed'      => false,
+            'listQuery'          => '',
+            'listResult'         => false
         );
-        wp_enqueue_script('glm-members-admin-google-maps-marker-clusterer', false, array('jquery'), false, true);
-
-        $where                = '';
-        $whereSep             = '';
-        $filterPending        = false;
-        $filterArchived       = false;
-        $filterFeatured       = false;
-        $filterName           = false;
-        $haveFilter           = false;
-        $textSearch           = '';
-        $blankStart           = false;
-        $citySearchSelect     = false;
-        $membersFound         = false;
-        $catSearchSelected    = false;
-        $regionSearchSelected = false;
-        $mapItems             = false;
-        $multiSelectCats      = false;
-        $filteredMembersFound = false;
-        $list                 = false;
-        $citySearchSelected   = false;
-        $haveFeaturedMembers  = false;
-        $featuredMembers      = false;
-        $fullTextSearch       = false;
-        $appendSelect         = '';
-        $memberType           = false;
-        $categorySearch       = false;
-        $amenitySearch        = false;
-        $citySearch           = false;
-        $ajaxRequest          = false;
+
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+            trigger_error('Instance Count for this Page: glm-members-list = '.$thisInstance['instanceCount'], E_USER_NOTICE);
+        }
+
+        $messages                    = array();
+
+        // These parameters are preserved when list data is generated
+        static $ajaxRequest          = false;
+        static $alphaList            = false;
+        static $alphaSelected        = false;
+        static $amenityData          = false;
+        static $amenitySearch        = false;
+        static $amenSelected         = false;
+        static $appendSelect         = '';
+        static $blankStart           = false;
+        static $categoryData         = false;
+        static $categorySearch       = false;
+        static $catSearchSelected    = false;
+        static $catSelected          = false;
+        static $citySearch           = false;
+        static $cityData             = false;
+        static $citySearchSelect     = false;
+        static $citySearchSelected   = false;
+        static $featuredMembers      = false;
+        static $filterArchived       = false;
+        static $filterFeatured       = false;
+        static $filterName           = false;
+        static $filterPending        = false;
+        static $filteredMembersFound = false;
+        static $fullTextSearch       = false;
+        static $haveFeaturedMembers  = false;
+        static $haveFilter           = false;
+        static $haveMembers          = false;
+        static $list                 = false;
+        static $mapItems             = false;
+        static $membersFound         = false;
+        static $memberType           = false;
+        static $multiSelectCats      = false;
+        static $regionData           = false;
+        static $regionSearchSelected = false;
+        static $singleCategory       = false;
+        static $success              = false;
+        static $textSearch           = '';
+        static $view                 = false;
+        static $where                = '';
+        static $whereSep             = '';
 
         // Paging Parameters
-        $paging        = $this->config['settings']['list_pagination']; // Now this is in management
-        $numbDisplayed = false;
-        $lastDisplayed = false;
-        $prevStart     = false;
-        $nextStart     = false;
-        $start         = 1;
-        $limit         = $this->config['settings']['list_pagination_count']; // Now this is in management
+        static $paging        = false;
+        static $numbDisplayed = false;
+        static $lastDisplayed = false;
+        static $prevStart     = false;
+        static $nextStart     = false;
+        static $start         = 1;
+        static $limit         = false;
+
+        // If this is the first instance, then set these paramters
+        if (!$thisInstance['instanceCount']) {
+            $paging        = $this->config['settings']['list_pagination']; // Now this is in management
+            $limit         = $this->config['settings']['list_pagination_count']; // Now this is in management
+        }
 
         // Pre-load settings array with management settings as default using the list above
         $settings = array();
@@ -346,753 +387,826 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
             $settings['list_show_outer_container'] = false;
         }
 
-        // Apply any provided text search to name, description, short description, and street address
-        if ( isset($actionData['request']['text-search']) && trim($actionData['request']['text-search']) != '') {
-            $textSearch = addslashes(stripslashes(filter_var($actionData['request']['text-search'], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)));
-            $where .= $whereSep." (
-                ( match(member_name) against('$textSearch') )
-                OR
-                ( T.descr SOUNDS LIKE '$textSearch' OR T.descr LIKE '%$textSearch%' )
-                OR
-                T.short_descr LIKE '%$textSearch%'
-                OR
-                T.addr1 LIKE '%$textSearch%'
-                OR
-                T.addr2 LIKE '%$textSearch%'
-            )";
-            // City part (on hold)
-            // OR T.city IN (
-            //     SELECT id FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities
-            //      WHERE name SOUNDS LIKE '%$textSearch%' OR name LIKE '%$textSearch%'
-            //  )
-            $appendSelect = " match(member_name) against('$textSearch') as rel_name ";
-            $whereSep = ' AND ';
-            $textSearch = stripslashes($textSearch);
-            $fullTextSearch = true;
-        }
-
-        // Get regions for possible use in search pick list for regions used in active member info records.
-        require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php';
-        $Regions = new GlmDataRegions($this->wpdb, $this->config);
-        $regionData = $Regions->getListForSearch(true, $actionData);
+        // If we don't already have a completed list query
+        if (!$thisInstance['listQuery']) {
+
+            $thisInstance['listQuery'] = true;
+
+echo "<h1>RUNNING QUERY</h1>";
+
+            // Apply any provided text search to name, description, short description, and street address
+            if ( isset($actionData['request']['text-search']) && trim($actionData['request']['text-search']) != '') {
+                $textSearch = addslashes(stripslashes(filter_var($actionData['request']['text-search'], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)));
+                $where .= $whereSep." (
+                    ( match(member_name) against('$textSearch') )
+                    OR
+                    ( T.descr SOUNDS LIKE '$textSearch' OR T.descr LIKE '%$textSearch%' )
+                    OR
+                    T.short_descr LIKE '%$textSearch%'
+                    OR
+                    T.addr1 LIKE '%$textSearch%'
+                    OR
+                    T.addr2 LIKE '%$textSearch%'
+                )";
+                // City part (on hold)
+                // OR T.city IN (
+                //     SELECT id FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities
+                //      WHERE name SOUNDS LIKE '%$textSearch%' OR name LIKE '%$textSearch%'
+                //  )
+                $appendSelect = " match(member_name) against('$textSearch') as rel_name ";
+                $whereSep = ' AND ';
+                $textSearch = stripslashes($textSearch);
+                $fullTextSearch = true;
+            }
 
-        // Get cities for possible use in search pick list for cities used in active member info records.
-        require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php';
-        $cities = new GlmDataCities($this->wpdb, $this->config);
-        $cityData = $cities->getListForSearch(true, $actionData);      // Get only categories that are used in active member data
+            // Get regions for possible use in search pick list for regions used in active member info records.
+            require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php';
+            $Regions = new GlmDataRegions($this->wpdb, $this->config);
+            $regionData = $Regions->getListForSearch(true, $actionData);
 
+            // Get cities for possible use in search pick list for cities used in active member info records.
+            require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php';
+            $cities = new GlmDataCities($this->wpdb, $this->config);
+            $cityData = $cities->getListForSearch(true, $actionData);      // Get only categories that are used in active member data
 
-        // If we have a region set in shortcode or via URL.
-        $regions = array();
-        if ( isset( $actionData['request']['region-search'] ) && $actionData['request']['region-search']) {
+            // If we have a region set in shortcode or via URL.
+            $regions = array();
+            if ( isset( $actionData['request']['region-search'] ) && $actionData['request']['region-search']) {
 
-            // Convert comma separated list to an array
-            $regionsRequested = explode( ',', $actionData['request']['region-search'] );
+                // Convert comma separated list to an array
+                $regionsRequested = explode( ',', $actionData['request']['region-search'] );
 
-            // Check for numeric ID's only
-            while ( list( $k, $v ) = each( $regionsRequested ) ) {
-                if ( preg_match( '/^[0-9]*$/', trim( $v ) && $v > 0 ) ) {
-                    $regions[] = ( $v - 0 );
+                // Check for numeric ID's only
+                while ( list( $k, $v ) = each( $regionsRequested ) ) {
+                    if ( preg_match( '/^[0-9]*$/', trim( $v ) && $v > 0 ) ) {
+                        $regions[] = ( $v - 0 );
+                    }
                 }
-            }
 
-            if ( isset( $regions ) && !empty( $regions ) ) {
-                $where .= $whereSep." T.region IN (" . implode( ',', $regions ) . ")";
-                $whereSep = ' AND ';
+                if ( isset( $regions ) && !empty( $regions ) ) {
+                    $where .= $whereSep." T.region IN (" . implode( ',', $regions ) . ")";
+                    $whereSep = ' AND ';
+                }
             }
-        }
 
-        $counties = array();
-        // If we have a county set in shortcode or via URL.
-        if ( isset( $actionData['request']['county-search'] ) && $actionData['request']['county-search']) {
+            $counties = array();
+            // If we have a county set in shortcode or via URL.
+            if ( isset( $actionData['request']['county-search'] ) && $actionData['request']['county-search']) {
 
-            // Convert comma separated list to an array
-            $regionsRequested = explode( ',', $actionData['request']['county-search'] );
+                // Convert comma separated list to an array
+                $regionsRequested = explode( ',', $actionData['request']['county-search'] );
 
-            // Check for numeric ID's only
-            while ( list( $k, $v ) = each( $regionsRequested ) ) {
-                if ( preg_match( '/^[0-9]*$/', trim( $v ) && $v > 0 ) ) {
-                    $counties[] = ( $v - 0 );
+                // Check for numeric ID's only
+                while ( list( $k, $v ) = each( $regionsRequested ) ) {
+                    if ( preg_match( '/^[0-9]*$/', trim( $v ) && $v > 0 ) ) {
+                        $counties[] = ( $v - 0 );
+                    }
                 }
-            }
 
-            if ( isset( $counties ) && !empty( $counties ) ) {
-                $where .= $whereSep." T.county IN (" . implode( ',', $counties ) . ")";
-                $whereSep = ' AND ';
+                if ( isset( $counties ) && !empty( $counties ) ) {
+                    $where .= $whereSep." T.county IN (" . implode( ',', $counties ) . ")";
+                    $whereSep = ' AND ';
+                }
             }
-        }
 
-        // If there's regions shortcode or url options to restrict this page to certain regions
-        if (count($regions) > 0) {
+            // If there's regions shortcode or url options to restrict this page to certain regions
+            if (count($regions) > 0) {
 
-            while ( list($k,$v) = each ($regionData) ) {
-                if (!in_array($v['id'], $regions)) {
-                    unset ($regionData[$k]);
+                while ( list($k,$v) = each ($regionData) ) {
+                    if (!in_array($v['id'], $regions)) {
+                        unset ($regionData[$k]);
+                    }
                 }
-            }
 
-        }
+            }
 
-        // If we have a city set in shortcode or via URL.
-        $cities = array();
-        if ( isset( $actionData['request']['city-search'] )
-            && $actionData['request']['city-search']
-        ) {
+            // If we have a city set in shortcode or via URL.
+            $cities = array();
+            if ( isset( $actionData['request']['city-search'] )
+                && $actionData['request']['city-search']
+            ) {
 
-            // Convert comma separated list to an array
-            $citiesRequested = explode( ',', $actionData['request']['city-search'] );
+                // Convert comma separated list to an array
+                $citiesRequested = explode( ',', $actionData['request']['city-search'] );
 
-            // Check for numeric ID's only
-            while ( list( $k, $v ) = each( $citiesRequested ) ) {
-                if ( preg_match( '/^[0-9]*$/', trim( $v ) && $v > 0 ) ) {
-                    $cities[] = ( $v - 0 );
+                // Check for numeric ID's only
+                while ( list( $k, $v ) = each( $citiesRequested ) ) {
+                    if ( preg_match( '/^[0-9]*$/', trim( $v ) && $v > 0 ) ) {
+                        $cities[] = ( $v - 0 );
+                    }
                 }
-            }
 
-            if ( isset( $cities ) && !empty( $cities ) ) {
-                $where .= $whereSep." T.city IN (" . implode( ',', $cities ) . ")";
-                $whereSep = ' AND ';
+                if ( isset( $cities ) && !empty( $cities ) ) {
+                    $where .= $whereSep." T.city IN (" . implode( ',', $cities ) . ")";
+                    $whereSep = ' AND ';
+                }
             }
-        }
 
-        // If there's city's shortcode or url options to restrict this page to certain cities
-        if (count($cities) > 0) {
+            // If there's city's shortcode or url options to restrict this page to certain cities
+            if (count($cities) > 0) {
 
-            while ( list($k,$v) = each ($cityData) ) {
-                if (!in_array($v['id'], $cities)) {
-                    unset ($cityData[$k]);
-                }
-            }
-        }
-        // Check for user region selection
-        $categoryRegionList = '';
-        $categoryRegionSep = '';
-        if (isset($_REQUEST) && is_array($regionData) && (isset($_REQUEST['regionUserSearch']) && count($_REQUEST['regionUserSearch']) > 0) || (isset($_REQUEST['regionSearch']) && $_REQUEST['regionSearch'] != "")) {
-            foreach ($regionData as $r) {
-                $id = $r['id'];
-                $regionData[$id]['default'] = false;
-                if ( (isset($_REQUEST['regionUserSearch']) && in_array($id, $_REQUEST['regionUserSearch'])) || (isset($_REQUEST['regionSearch']) && $id == $_REQUEST['regionSearch']) ) {
-                    $regionData[$id]['default'] = true;
-                    $regionSearchSelected = $id;
-                    $where .= $whereSep." T.region = $id";
-                    $whereSep = ' AND ';
-                    $categoryRegionList .= $categoryRegionSep."$id";
-                    $categoryRegionSep = ', ';
+                while ( list($k,$v) = each ($cityData) ) {
+                    if (!in_array($v['id'], $cities)) {
+                        unset ($cityData[$k]);
+                    }
                 }
             }
-        } else {
-            // Double check that we have an array from $regionData
-            if ( isset( $regionData ) && is_array( $regionData ) ) {
-                reset($regionData);
+            // Check for user region selection
+            $categoryRegionList = '';
+            $categoryRegionSep = '';
+            if (isset($_REQUEST) && is_array($regionData) && (isset($_REQUEST['regionUserSearch']) && count($_REQUEST['regionUserSearch']) > 0) || (isset($_REQUEST['regionSearch']) && $_REQUEST['regionSearch'] != "")) {
                 foreach ($regionData as $r) {
                     $id = $r['id'];
                     $regionData[$id]['default'] = false;
-                    if (in_array($id, $regions)) {
+                    if ( (isset($_REQUEST['regionUserSearch']) && in_array($id, $_REQUEST['regionUserSearch'])) || (isset($_REQUEST['regionSearch']) && $id == $_REQUEST['regionSearch']) ) {
+                        $regionData[$id]['default'] = true;
+                        $regionSearchSelected = $id;
+                        $where .= $whereSep." T.region = $id";
+                        $whereSep = ' AND ';
                         $categoryRegionList .= $categoryRegionSep."$id";
                         $categoryRegionSep = ', ';
                     }
                 }
-            }
-        }
-
-        // Check for user city selection
-        $categoryCityList = '';
-        $categoryCitySep = '';
-        if (isset($_REQUEST) && is_array($cityData) && (isset($_REQUEST['cityUserSearch']) && count($_REQUEST['cityUserSearch']) > 0) || (isset($_REQUEST['citySearch']) && $_REQUEST['citySearch'] != "")) {
-            foreach ($cityData as $r) {
-                $id = $r['id'];
-                $cityData[$id]['default'] = false;
-                if ( (isset($_REQUEST['cityUserSearch']) && in_array($id, $_REQUEST['cityUserSearch'])) || (isset($_REQUEST['citySearch']) && $id == $_REQUEST['citySearch']) ) {
-                    $cityData[$id]['default'] = true;
-                    $citySearchSelected = $id;
-                    $where .= $whereSep." T.city = $id";
-                    $whereSep = ' AND ';
-                    $categoryCityList .= $categoryCitySep."$id";
-                    $categoryCitySep = ', ';
+            } else {
+                // Double check that we have an array from $regionData
+                if ( isset( $regionData ) && is_array( $regionData ) ) {
+                    reset($regionData);
+                    foreach ($regionData as $r) {
+                        $id = $r['id'];
+                        $regionData[$id]['default'] = false;
+                        if (in_array($id, $regions)) {
+                            $categoryRegionList .= $categoryRegionSep."$id";
+                            $categoryRegionSep = ', ';
+                        }
+                    }
                 }
             }
-        } else {
-            // Double check that we have an array from $regionData
-            if ( isset( $cityData ) && is_array( $cityData ) ) {
-                reset($cityData);
+
+            // Check for user city selection
+            $categoryCityList = '';
+            $categoryCitySep = '';
+            if (isset($_REQUEST) && is_array($cityData) && (isset($_REQUEST['cityUserSearch']) && count($_REQUEST['cityUserSearch']) > 0) || (isset($_REQUEST['citySearch']) && $_REQUEST['citySearch'] != "")) {
                 foreach ($cityData as $r) {
                     $id = $r['id'];
                     $cityData[$id]['default'] = false;
-                    if (in_array($id, $cities)) {
+                    if ( (isset($_REQUEST['cityUserSearch']) && in_array($id, $_REQUEST['cityUserSearch'])) || (isset($_REQUEST['citySearch']) && $id == $_REQUEST['citySearch']) ) {
+                        $cityData[$id]['default'] = true;
+                        $citySearchSelected = $id;
+                        $where .= $whereSep." T.city = $id";
+                        $whereSep = ' AND ';
                         $categoryCityList .= $categoryCitySep."$id";
                         $categoryCitySep = ', ';
                     }
                 }
+            } else {
+                // Double check that we have an array from $regionData
+                if ( isset( $cityData ) && is_array( $cityData ) ) {
+                    reset($cityData);
+                    foreach ($cityData as $r) {
+                        $id = $r['id'];
+                        $cityData[$id]['default'] = false;
+                        if (in_array($id, $cities)) {
+                            $categoryCityList .= $categoryCitySep."$id";
+                            $categoryCitySep = ', ';
+                        }
+                    }
+                }
             }
-        }
 
-        // Get any numeric member types selected in the submitted shortcode and add to $types array.
-        // We are currently only doing type selection by ID in the shortcode. No search parameters.
-        $typesSelected = '';
-        $types = array();
-        if (isset($actionData['request']['type'])) {
+            // Get any numeric member types selected in the submitted shortcode and add to $types array.
+            // We are currently only doing type selection by ID in the shortcode. No search parameters.
+            $typesSelected = '';
+            $types = array();
+            if (isset($actionData['request']['type'])) {
+
+                // Convert comma separated list to an array
+                $typesRequested = explode(',', $actionData['request']['type']);
 
-            // Convert comma separated list to an array
-            $typesRequested = explode(',', $actionData['request']['type']);
+                // Check for numeric IDs only
+                while (list($k, $v) = each($typesRequested)) {
 
-            // Check for numeric IDs only
-            while (list($k, $v) = each($typesRequested)) {
+                    // If it's just numeric - note Explode returns an array element with value = 0 if no string.
+                    if (preg_match('/^[0-9]*$/', trim($v)) && $v > 0) {
 
-                // If it's just numeric - note Explode returns an array element with value = 0 if no string.
-                if (preg_match('/^[0-9]*$/', trim($v)) && $v > 0) {
+                        // Clean up the type ID number and add to types array
+                        $types[] = ($v-0);
 
-                    // Clean up the type ID number and add to types array
-                    $types[] = ($v-0);
+                    }
 
                 }
 
             }
+            $typeSelected = implode(',', $types);
+            $typeSelectedForQuery = $typeSelected;
 
-        }
-        $typeSelected = implode(',', $types);
-        $typeSelectedForQuery = $typeSelected;
+            // Get category data for possible use in search pick list for categories used in active member info records.
+            require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php';
+            $Categories = new GlmDataCategories($this->wpdb, $this->config);
+            $categoryData = $Categories->getListSortedParentChild(false, true, $categoryRegionList);             // Get only categories that are used in active member data
 
-        // Get category data for possible use in search pick list for categories used in active member info records.
-        require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php';
-        $Categories = new GlmDataCategories($this->wpdb, $this->config);
-        $categoryData = $Categories->getListSortedParentChild(false, true, $categoryRegionList);             // Get only categories that are used in active member data
+            // Get any numeric categories selected in the submitted shortcode and add to $cats array.
+            // This sets categories that are available for selection by the user
+            $catSelected = '';
+            $cats = array();
+            if (isset($actionData['request']['category'])) {
 
-        // Get any numeric categories selected in the submitted shortcode and add to $cats array.
-        // This sets categories that are available for selection by the user
-        $catSelected = '';
-        $cats = array();
-        if (isset($actionData['request']['category'])) {
+                // Convert comma separated list to an array
+                $catsRequested = explode(',', $actionData['request']['category']);
 
-            // Convert comma separated list to an array
-            $catsRequested = explode(',', $actionData['request']['category']);
+                // Check for numeric IDs only
+                while (list($k, $v) = each($catsRequested)) {
 
-            // Check for numeric IDs only
-            while (list($k, $v) = each($catsRequested)) {
+                    // If it's just numeric - note Explode returns an array element with value = 0 if no string.
+                    if (preg_match('/^[0-9]*$/', trim($v)) && $v > 0) {
 
-                // If it's just numeric - note Explode returns an array element with value = 0 if no string.
-                if (preg_match('/^[0-9]*$/', trim($v)) && $v > 0) {
+                        // Clean up the category number and add to cats array
+                        $cats[] = ($v-0);
 
-                    // Clean up the category number and add to cats array
-                    $cats[] = ($v-0);
+                    }
 
                 }
 
             }
 
-        }
+            // Get any text categories selected in the submitted shortcode and add to $cats array
+            // This sets categories that are available for selection by the user.
+            if (isset($actionData['request']['category-name'])) {
 
-        // Get any text categories selected in the submitted shortcode and add to $cats array
-        // This sets categories that are available for selection by the user.
-        if (isset($actionData['request']['category-name'])) {
+                // Break up shortcode categories into an array to make searching easy
+                $catsRequested = explode('|', $actionData['request']['category-name']);
 
-            // Break up shortcode categories into an array to make searching easy
-            $catsRequested = explode('|', $actionData['request']['category-name']);
+                // Check for numeric or text selection of categories
+                while (list($k, $v) = each($catsRequested)) {
 
-            // Check for numeric or text selection of categories
-            while (list($k, $v) = each($catsRequested)) {
+                    $vStripped = html_entity_decode(stripslashes(trim($v)));
 
-                $vStripped = html_entity_decode(stripslashes(trim($v)));
+                    if ( isset( $categoryData ) && is_array( $categoryData ) ) {
+                        reset($categoryData);
+                        foreach ($categoryData as $c) {
 
-                if ( isset( $categoryData ) && is_array( $categoryData ) ) {
-                    reset($categoryData);
-                    foreach ($categoryData as $c) {
-
-                        $x = html_entity_decode(stripslashes(trim($c['name'])));
+                            $x = html_entity_decode(stripslashes(trim($c['name'])));
 
-                        // If this entry matches - apply html entity decode in case string is encoded
-                        if ($x == $vStripped) {
+                            // If this entry matches - apply html entity decode in case string is encoded
+                            if ($x == $vStripped) {
 
-                            // Update the $cats array with the ID rather than the name and mark as found
-                            $cats[] = $c['id'];
+                                // Update the $cats array with the ID rather than the name and mark as found
+                                $cats[] = $c['id'];
+                            }
                         }
                     }
+
                 }
 
             }
 
-        }
+            // If there's categories specified above ($cats array) - and we have category data
+            if (count($cats) > 0 && isset( $categoryData ) && is_array( $categoryData )) {
 
-        // If there's categories specified above ($cats array) - and we have category data
-        if (count($cats) > 0 && isset( $categoryData ) && is_array( $categoryData )) {
+                // Check if this is a submitted multi-select for categories, set selected rather than remove other categories
+                if ($multiSelectCats) {
 
-            // Check if this is a submitted multi-select for categories, set selected rather than remove other categories
-            if ($multiSelectCats) {
+                    // Add ['default'] value to all categories
+                    reset($categoryData);
+                    while (list($k, $v) = each($categoryData)) {
+                        $categoryData[$k]['default'] = false;
+                    }
 
-                // Add ['default'] value to all categories
-                reset($categoryData);
-                while (list($k, $v) = each($categoryData)) {
-                    $categoryData[$k]['default'] = false;
-                }
+                    // Now set that for the categories in $cats.
+                    reset($cats);
+                    foreach ($cats as $c) {
+                        $categoryData[$c]['default'] = true;
+                    }
 
-                // Now set that for the categories in $cats.
-                reset($cats);
-                foreach ($cats as $c) {
-                    $categoryData[$c]['default'] = true;
-                }
+                } else {
 
-            } else {
+                    /*  * Restrict available categories for selection to those in shortcode or children
+                     * Note that the array is already ordered by parent then children then next parent
+                     * so $parentSelected
+                     */
+                    $parentSelected = false;
+                    reset($categoryData);
+                    while (list($k, $v) = each($categoryData)) {
 
-                /*  * Restrict available categories for selection to those in shortcode or children
-                 * Note that the array is already ordered by parent then children then next parent
-                 * so $parentSelected
-                 */
-                $parentSelected = false;
-                reset($categoryData);
-                while (list($k, $v) = each($categoryData)) {
-
-                    // If this is a parent, then clear parent selected
-                    if ($v['parent_id'] != $parentSelected) {
-                        $parentSelected = false;
-                    }
+                        // If this is a parent, then clear parent selected
+                        if ($v['parent_id'] != $parentSelected) {
+                            $parentSelected = false;
+                        }
 
-                    // If category or parent is selected
-                    if ($parentSelected == false && !in_array($k, $cats)) {
+                        // If category or parent is selected
+                        if ($parentSelected == false && !in_array($k, $cats)) {
 
-                        // Drop this category from the list
-                        unset($categoryData[$k]);
+                            // Drop this category from the list
+                            unset($categoryData[$k]);
 
-                    // Otherwise, if this is a top-level category that's not dropped, save as currently selected parent
-                    } elseif (!$v['parent_id']) {
-                        $parentSelected = $k;
-                    }
+                        // Otherwise, if this is a top-level category that's not dropped, save as currently selected parent
+                        } elseif (!$v['parent_id']) {
+                            $parentSelected = $k;
+                        }
 
-                }
+                    }
 
-            } // Not multiselect cats
+                } // Not multiselect cats
 
-        }
+            }
 
-        $catSelected = implode(',', $cats);
-        $catSelectedForQuery = $catSelected;
+            $catSelected = implode(',', $cats);
+            $catSelectedForQuery = $catSelected;
 
-        // If we're doing category search selection Get category filter data
-        if ($this->config['settings']['list_show_search_category'] && !$multiSelectCats) {
+            // If we're doing category search selection Get category filter data
+            if ($this->config['settings']['list_show_search_category'] && !$multiSelectCats) {
 
-            // Add default flag as false to all entries
-            if ( isset( $categoryData ) && is_array( $categoryData ) ) {
-            foreach ($categoryData as $k=>$v) {
-                $categoryData[$k]['default'] = false;
+                // Add default flag as false to all entries
+                if ( isset( $categoryData ) && is_array( $categoryData ) ) {
+                foreach ($categoryData as $k=>$v) {
+                    $categoryData[$k]['default'] = false;
+                    }
                 }
-            }
 
-            // Check if a category has been submitted
-            if ($actionData['request']['category-search']) {
-                $c = $actionData['request']['category-search'] - 0;
+                // Check if a category has been submitted
+                if ($actionData['request']['category-search']) {
+                    $c = $actionData['request']['category-search'] - 0;
 
-                // Since we have one category selected by the user, make that default
-                if ($c && isset($categoryData[$c])) {
-                    $categoryData[$c]['default'] = true;
-                    $catSearchSelected = $c;
+                    // Since we have one category selected by the user, make that default
+                    if ($c && isset($categoryData[$c])) {
+                        $categoryData[$c]['default'] = true;
+                        $catSearchSelected = $c;
+
+                        // Also set that to be the only category used in the query
+                        $catSelectedForQuery = $catSearchSelected;
+                    }
 
-                    // Also set that to be the only category used in the query
-                    $catSelectedForQuery = $catSearchSelected;
                 }
 
             }
 
-        }
+            // If we have a member type IDs - Add that to the where clause
+            if ($typeSelectedForQuery != '') {
+                $where .= $whereSep." T.member in (
+                    SELECT DISTINCT(id)
+                     FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members
+                    WHERE member_type in ($typeSelectedForQuery)
+                )";
+                $whereSep = ' AND ';
+            }
 
-        // If we have a member type IDs - Add that to the where clause
-        if ($typeSelectedForQuery != '') {
-            $where .= $whereSep." T.member in (
-                SELECT DISTINCT(id)
-                 FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members
-                WHERE member_type in ($typeSelectedForQuery)
-            )";
-            $whereSep = ' AND ';
-        }
+            // If we have a category ID or IDs - Add that to the where clause and save $catWhere for featured members search
+            $catWhere = '';
+            if ($catSelectedForQuery != '') {
+                $catWhere = " T.id in (
+                        SELECT DISTINCT(member_info)
+                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info M,
+                               ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories C
+                         WHERE M.category in($catSelectedForQuery)
+                            OR (C.parent in($catSelectedForQuery) AND M.category = C.id)
+                )";
+                $where .= $whereSep.$catWhere;
+                $whereSep = ' AND ';
+            }
 
-        // If we have a category ID or IDs - Add that to the where clause and save $catWhere for featured members search
-        $catWhere = '';
-        if ($catSelectedForQuery != '') {
-            $catWhere = " T.id in (
-                    SELECT DISTINCT(member_info)
-                      FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info M,
-                           ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories C
-                     WHERE M.category in($catSelectedForQuery)
-                        OR (C.parent in($catSelectedForQuery) AND M.category = C.id)
-            )";
-            $where .= $whereSep.$catWhere;
-            $whereSep = ' AND ';
-        }
+            // Get amenity filter data
+            $amenityData = false;
+            $amenSelected = '';
+            $amenityGroups = false;
+            if ( isset( $actionData['request']['amenity-groups'] )
+                && $actionData['request']['amenity-groups']
+                && $actionData['request']['amenity-groups'] != 'amenity-groups'
+            ) {
+                $amenityGroups = $actionData['request']['amenity-groups'];
 
-        // Get amenity filter data
-        $amenityData = false;
-        $amenSelected = '';
-        $amenityGroups = false;
-        if ( isset( $actionData['request']['amenity-groups'] )
-            && $actionData['request']['amenity-groups']
-            && $actionData['request']['amenity-groups'] != 'amenity-groups'
-        ) {
-            $amenityGroups = $actionData['request']['amenity-groups'];
+            }
+            if ( $this->config['settings']['list_show_search_amenities'] &&
+                ( isset( $amenityGroups ) && $amenityGroups ) ) {
+
+                // Get amenity data for search pick list
+                require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php';
+                $Amenities   = new GlmDataAmenities( $this->wpdb, $this->config );
+                $amenity_sql =
+                "T.ref_type  = {$this->config['ref_type_numb']['MemberInfo']}
+                AND T.id IN (
+                    SELECT amenity_id
+                      FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "grouped_amenities
+                     WHERE searchable <> false";
+                // check to see if there are groups in shortcode
+                if ( $amenityGroups ) {
+                    $groups   = explode( ',', $amenityGroups );
+                    $f_groups = array_filter( $groups, 'is_numeric' );
+                    if ( !empty( $f_groups ) ) {
+                        $amenity_sql .= " AND group_id IN ( " . implode( ',', $f_groups ) ." ) ";
+                    }
+                }
+                $amenity_sql .= ")";
+                $amenityData = $Amenities->getList( $amenity_sql );
 
-        }
-        if ( $this->config['settings']['list_show_search_amenities'] &&
-            ( isset( $amenityGroups ) && $amenityGroups ) ) {
-
-            // Get amenity data for search pick list
-            require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php';
-            $Amenities   = new GlmDataAmenities( $this->wpdb, $this->config );
-            $amenity_sql =
-            "T.ref_type  = {$this->config['ref_type_numb']['MemberInfo']}
-            AND T.id IN (
-                SELECT amenity_id
-                  FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "grouped_amenities
-                 WHERE searchable <> false";
-            // check to see if there are groups in shortcode
-            if ( $amenityGroups ) {
-                $groups   = explode( ',', $amenityGroups );
-                $f_groups = array_filter( $groups, 'is_numeric' );
-                if ( !empty( $f_groups ) ) {
-                    $amenity_sql .= " AND group_id IN ( " . implode( ',', $f_groups ) ." ) ";
+                // Add default flag as false to all entries
+                if ( !empty( $amenityData ) ) {
+                    foreach ($amenityData as $k=>$v) {
+                        $amenityData[$k]['default'] = false;
+                    }
                 }
-            }
-            $amenity_sql .= ")";
-            $amenityData = $Amenities->getList( $amenity_sql );
 
-            // Add default flag as false to all entries
-            if ( !empty( $amenityData ) ) {
-                foreach ($amenityData as $k=>$v) {
-                    $amenityData[$k]['default'] = false;
+                // Check if an amenity has been submitted
+                if ($actionData['request']['amenity-search']) {
+                    $amenSelected = $actionData['request']['amenity-search'];
+                    $amenSelected = array_filter( $amenSelected, function($var){
+                        return is_numeric( $var ) && $var > 0;
+                    } );
+
+                    // If we have an amenity ID
+                    if ($amenSelected ) {
+
+                        // Build query to get the member ID's that have the selected amenity
+                        $where .= $whereSep." T.id in (
+                            SELECT DISTINCT(ref_dest)
+                              FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."amenity_ref
+                                       WHERE amenity IN ( " . implode( ',', $amenSelected ) . " )
+                                         AND ref_type = ".$this->config['ref_type_numb']['MemberInfo']."
+                            )";
+                        $whereSep = ' AND ';
+
+                        // Set default to true for the selected category
+                        foreach ( $amenityData as $amenElement ) {
+                            if ( in_array( $amenElement['id'], $amenSelected ) ) {
+                                $amenityData[$amenElement['id']]['default'] = true;
+                            }
+                        }
+
+                    } // If we have a sane amenity ID
+                } // If an amenity search has been selected
+            } // if doing amenity search
+            $amenityData = ( is_array( $amenityData ) ) ? array_filter( $amenityData ) : array();
+
+            /*
+             * Get Featured Members list if that is requested.
+             */
+            if ($this->config['settings']['list_show_featured'] && $this->config['settings']['list_show_featured_count'] > 0) {
+
+                $featuredMembersCount = $this->config['settings']['list_show_featured_count'];
+
+                // Build where for retieving featured members
+                $fmWhere = "
+                    T.member in (
+                        SELECT distinct(id)
+                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
+                         WHERE featured
+                    ) AND status = ".$this->config['status_numb']['Active']."
+                ";
+
+                // And if there's categories selected, use that also
+                if ($catWhere != '') {
+                    $fmWhere .= " AND $catWhere";
                 }
-            }
 
-            // Check if an amenity has been submitted
-            if ($actionData['request']['amenity-search']) {
-                $amenSelected = $actionData['request']['amenity-search'];
-                $amenSelected = array_filter( $amenSelected, function($var){
-                    return is_numeric( $var ) && $var > 0;
-                } );
-
-                // If we have an amenity ID
-                if ($amenSelected ) {
-
-                    // Build query to get the member ID's that have the selected amenity
-                    $where .= $whereSep." T.id in (
-                        SELECT DISTINCT(ref_dest)
-                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."amenity_ref
-                                   WHERE amenity IN ( " . implode( ',', $amenSelected ) . " )
-                                     AND ref_type = ".$this->config['ref_type_numb']['MemberInfo']."
-                        )";
-                    $whereSep = ' AND ';
+                // Get featured member data using limited info for map data
+                $fmList = $this->getSimpleMemberInfoList($fmWhere, true);
+                if (is_array($fmList) && count($fmList) > 0) {
+                    $fmIds = '';
+                    $sep ='';
+                    foreach ($fmList as $fm) {
+                        $fmIds .= $sep.$fm['member'];
+                        $sep = ', ';
+                    }
 
-                    // Set default to true for the selected category
-                    foreach ( $amenityData as $amenElement ) {
-                        if ( in_array( $amenElement['id'], $amenSelected ) ) {
-                            $amenityData[$amenElement['id']]['default'] = true;
-                        }
+                    $f = $this->fields;
+                    $this->fields = array(
+                        'id' => $f['id'],
+                        'member_slug' => $f['member_slug'],
+                        'member_name' => $f['member_name'],
+                        'addr1' => $f['addr1'],
+                        'addr2' => $f['addr2'],
+                        'city' => $f['city'],
+                        'state' => $f['state'],
+                        'zip' => $f['zip'],
+                        'phone' => $f['phone'],
+                        'toll_free' => $f['toll_free'],
+                        'email' => $f['email'],
+                        'url' => $f['url'],
+                        'logo' => $f['logo'],
+                        'short_descr' => $f['short_descr']
+                    );
+                    $fmWhere = "T.member in ($fmIds) AND status = ".$this->config['status_numb']['Active'];
+                    $fmTemp = $this->getList($fmWhere, 'random', false, 'id', 1, $featuredMembersCount, false);
+                    if (isset($fmTemp['list']) && is_array($fmTemp['list']) && $fmTemp['returned'] > 0) {
+                        $featuredMembers = $fmTemp['list'];
+                        $haveFeaturedMembers = true;
                     }
+                    $this->fields = $f;
 
-                } // If we have a sane amenity ID
-            } // If an amenity search has been selected
-        } // if doing amenity search
-        $amenityData = ( is_array( $amenityData ) ) ? array_filter( $amenityData ) : array();
+                }
+            }
 
-        /*
-         * Get Featured Members list if that is requested.
-         */
-        if ($this->config['settings']['list_show_featured'] && $this->config['settings']['list_show_featured_count'] > 0) {
-
-            $featuredMembersCount = $this->config['settings']['list_show_featured_count'];
-
-            // Build where for retieving featured members
-            $fmWhere = "
-                T.member in (
-                    SELECT distinct(id)
-                      FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
-                     WHERE featured
-                ) AND status = ".$this->config['status_numb']['Active']."
-            ";
-
-            // And if there's categories selected, use that also
-            if ($catWhere != '') {
-                $fmWhere .= " AND $catWhere";
+            $whereParts = apply_filters('glm-member-db-front-search-query', array());
+            if ( is_array( $whereParts ) && count( $whereParts ) > 0 ) {
+                $where .= $whereSep.implode(" AND ", $whereParts);
+                $whereSep = ' AND ';
             }
 
-            // Get featured member data using limited info for map data
-            $fmList = $this->getSimpleMemberInfoList($fmWhere, true);
-            if (is_array($fmList) && count($fmList) > 0) {
-                $fmIds = '';
-                $sep ='';
-                foreach ($fmList as $fm) {
-                    $fmIds .= $sep.$fm['member'];
-                    $sep = ', ';
+            // Only look at active member information where the member is displayable  (access = 20, 30, 40)
+            $where .= $whereSep."
+                (
+                    SELECT access
+                     FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members
+                    WHERE id = T.member
+                ) IN (
+                     ".$this->config['access_numb']['NoAccess'].",
+                     ".$this->config['access_numb']['Moderated'].",
+                     ".$this->config['access_numb']['Full']."
+                     )
+                AND T.status = ".$this->config['status_numb']['Active'];
+
+            // If doing alpha list
+            $alphaList = false;
+            $alphaWhere = '';
+            if ($this->config['settings']['list_show_search_alpha']) {
+
+                $alphaSelected = false;
+
+                // Check for alpha selected
+                if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) {
+                    $alphaSelected = strtoupper($actionData['request']['alpha']);
+                    $alphaWhere .= " AND T.member_name LIKE '$alphaSelected%'";
                 }
 
-                $f = $this->fields;
-                $this->fields = array(
-                    'id' => $f['id'],
-                    'member_slug' => $f['member_slug'],
-                    'member_name' => $f['member_name'],
-                    'addr1' => $f['addr1'],
-                    'addr2' => $f['addr2'],
-                    'city' => $f['city'],
-                    'state' => $f['state'],
-                    'zip' => $f['zip'],
-                    'phone' => $f['phone'],
-                    'toll_free' => $f['toll_free'],
-                    'email' => $f['email'],
-                    'url' => $f['url'],
-                    'logo' => $f['logo'],
-                    'short_descr' => $f['short_descr']
-                );
-                $fmWhere = "T.member in ($fmIds) AND status = ".$this->config['status_numb']['Active'];
-                $fmTemp = $this->getList($fmWhere, 'random', false, 'id', 1, $featuredMembersCount, false);
-                if (isset($fmTemp['list']) && is_array($fmTemp['list']) && $fmTemp['returned'] > 0) {
-                    $featuredMembers = $fmTemp['list'];
-                    $haveFeaturedMembers = true;
-                }
-                $this->fields = $f;
+                // Get full list for all other filters, but not filtered by alpha (that would be silly)
+                $alphaList = $this->getAlphaList(' AND '.$where, $alphaSelected);
 
             }
-        }
 
-        $whereParts = apply_filters('glm-member-db-front-search-query', array());
-        if ( is_array( $whereParts ) && count( $whereParts ) > 0 ) {
-            $where .= $whereSep.implode(" AND ", $whereParts);
-            $whereSep = ' AND ';
-        }
+            /*
+             * Check for which view file to use, else default to list
+             */
+    /*
+            $view = "list";
+            if (isset($actionData['request']['view']) && $actionData['request']['view'] != "" ) {
+                $view = strtolower($actionData['request']['view']);
+            }
+            if ( isset( $_REQUEST['view'] ) && $_REQUEST['view'] ) {
+                $view = $_REQUEST['view'];
+            }
+    */
+
+            /*
+             * Check for a blank start - No members selected, just search form
+             */
+            $blankStart = false;
+            if (isset($actionData['request']['blank-start']) &&
+                    strtolower($actionData['request']['blank-start']) == 'true' &&
+                    !isset($_REQUEST['glm_action']) ) {
+                $blankStart = true;
+                $paging = false;                            // If this is a blank start, then turn off paging to avoid errors
+            }
+
+            // Check if we're doing paging
+            if (isset($_REQUEST['pageSelect'])) {
 
-        // Only look at active member information where the member is displayable  (access = 20, 30, 40)
-        $where .= $whereSep."
-            (
-                SELECT access
-                 FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members
-                WHERE id = T.member
-            ) IN (
-                 ".$this->config['access_numb']['NoAccess'].",
-                 ".$this->config['access_numb']['Moderated'].",
-                 ".$this->config['access_numb']['Full']."
-                 )
-            AND T.status = ".$this->config['status_numb']['Active'];
-
-        // If doing alpha list
-        $alphaList = false;
-        $alphaWhere = '';
-        if ($this->config['settings']['list_show_search_alpha']) {
-
-            $alphaSelected = false;
-
-            // Check for alpha selected
-            if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) {
-                $alphaSelected = strtoupper($actionData['request']['alpha']);
-                $alphaWhere .= " AND T.member_name LIKE '$alphaSelected%'";
+                // If request is for Next
+                if ($_REQUEST['pageSelect'] == 'Next') {
+                    $newStart = $_REQUEST['nextStart'] - 0;
+
+                // Otherwise it must be Previous
+                } else {
+                    $newStart = $_REQUEST['prevStart'] - 0;
+                }
+
+                if ($newStart > 0) {
+                    $start = $newStart;
+                }
             }
 
-            // Get full list for all other filters, but not filtered by alpha (that would be silly)
-            $alphaList = $this->getAlphaList(' AND '.$where, $alphaSelected);
+            // If we're not paging, then force $start and $limit to false to data abstract returns everything.
+            $resultParam = 'listResult';
+            if (!$paging) {
+                $start = false;
+                $limit = false;
+                $resultParam = 'list';
+            }
 
-        }
+            // Get a simplified full list of member data for the map. Limit by selected Alpha is used.
+    //        require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/memberDataByLatLon.php';
+    //        $MapItems = new GlmMembersFront_members_memberDataByLatLon($this->wpdb, $this->config);
+            $mapItems = $this->getSimpleMemberInfoList($where.$alphaWhere, true);
 
-        /*
-         * Check for which view file to use, else default to list
-         */
-/*
-        $view = "list";
-        if (isset($actionData['request']['view']) && $actionData['request']['view'] != "" ) {
-            $view = strtolower($actionData['request']['view']);
-        }
-        if ( isset( $_REQUEST['view'] ) && $_REQUEST['view'] ) {
-            $view = $_REQUEST['view'];
-        }
-*/
+            /*
+             *  Get a current list of members - unless this is a blank start
+             */
+            if (!$blankStart) {
 
-        /*
-         * Check for a blank start - No members selected, just search form
-         */
-        $blankStart = false;
-        if (isset($actionData['request']['blank-start']) &&
-                strtolower($actionData['request']['blank-start']) == 'true' &&
-                !isset($_REQUEST['glm_action']) ) {
-            $blankStart = true;
-            $paging = false;                            // If this is a blank start, then turn off paging to avoid errors
-        }
+                // Get stats for the current selection
+                $membersFound = $this->getStats(str_replace('T.', '', $where));
 
-        // Check if we're doing paging
-        if (isset($_REQUEST['pageSelect'])) {
+                // Get stats for number of members found matching current selection criteria (includes alpha selection)
+                $filteredMembersFound = $this->getStats(str_replace('T.', '', $where.$alphaWhere));
 
-            // If request is for Next
-            if ($_REQUEST['pageSelect'] == 'Next') {
-                $newStart = $_REQUEST['nextStart'] - 0;
+                // If there's a full text search, handle separately
+                if ( $fullTextSearch ) {
 
-            // Otherwise it must be Previous
-            } else {
-                $newStart = $_REQUEST['prevStart'] - 0;
-            }
+                    // echo '<pre>$fullTextSearch: ' . print_r( $fullTextSearch, true ) . '</pre>';
+                    if ( $appendSelect ) {
+                        $order = " rel_name DESC, member_name ASC ";
+                    } else {
+                        $order = " member_name ASC ";
+                    }
+                    // echo '<pre>$order: ' . print_r( $order, true ) . '</pre>';
+                    ${$resultParam} = $this->getList(
+                        $where.$alphaWhere, // where
+                        $order,             // order
+                        true,               // fieldVals
+                        'id',               // idField
+                        $start,             // start
+                        $limit,             // limit
+                        '',                 // prohibitListOptions
+                        $appendSelect
+                    );
+
+                // When not full text search sort according to settings
+                } else {
 
-            if ($newStart > 0) {
-                $start = $newStart;
-            }
-        }
+                    // Get member list sorted as specified
+                    switch ($this->config['settings']['list_order_list']) {
 
-        // If we're not paging, then force $start and $limit to false to data abstract returns everything.
-        $resultParam = 'listResult';
-        if (!$paging) {
-            $start = false;
-            $limit = false;
-            $resultParam = 'list';
-        }
+                        // Pseudo-Random list order
+                        case $this->config['sort_order_numb']['Pseudo-Random']:
+                            ${$resultParam} = $this->getList($where.$alphaWhere, 'pseudo-random', true, 'id', $start, $limit);
+                            break;
 
-        // Get a simplified full list of member data for the map. Limit by selected Alpha is used.
-//        require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/memberDataByLatLon.php';
-//        $MapItems = new GlmMembersFront_members_memberDataByLatLon($this->wpdb, $this->config);
-        $mapItems = $this->getSimpleMemberInfoList($where.$alphaWhere, true);
+                            // Random list order
+                        case $this->config['sort_order_numb']['Random']:
+                            ${$resultParam} = $this->getList($where.$alphaWhere, 'random', true, 'id', $start, $limit);
+                            break;
 
-        /*
-         *  Get a current list of members - unless this is a blank start
-         */
-        if (!$blankStart) {
+                        // Default is alpha-numeric list order
+                        default:
+                        case $this->config['sort_order_numb']['Alpha-Numeric']:
+                            $sortOrder = apply_filters( 'glm-member-db-front-search-query-orderby', 'member_name' );
+                            ${$resultParam} = $this->getList($where.$alphaWhere, $sortOrder, true, 'id', $start, $limit);
+                            break;
 
-            // Get stats for the current selection
-            $membersFound = $this->getStats(str_replace('T.', '', $where));
+                    }
+                }
 
-            // Get stats for number of members found matching current selection criteria (includes alpha selection)
-            $filteredMembersFound = $this->getStats(str_replace('T.', '', $where.$alphaWhere));
+            }
 
-            // If there's a full text search, handle separately
-            if ( $fullTextSearch ) {
+            if ($paging) {
 
-                // echo '<pre>$fullTextSearch: ' . print_r( $fullTextSearch, true ) . '</pre>';
-                if ( $appendSelect ) {
-                    $order = " rel_name DESC, member_name ASC ";
+                // Get paging results - With paging getList() returns an array with additional paging data
+                $numbDisplayed = $listResult['returned'];
+                $lastDisplayed = $listResult['last'];
+                if ($start == 1) {
+                    $prevStart = false;
                 } else {
-                    $order = " member_name ASC ";
+                    $prevStart = $start - $limit;
+                    if ($start < 1) {
+                        $start = 1;
+                    }
                 }
-                // echo '<pre>$order: ' . print_r( $order, true ) . '</pre>';
-                ${$resultParam} = $this->getList(
-                    $where.$alphaWhere, // where
-                    $order,             // order
-                    true,               // fieldVals
-                    'id',               // idField
-                    $start,             // start
-                    $limit,             // limit
-                    '',                 // prohibitListOptions
-                    $appendSelect
-                );
-
-            // When not full text search sort according to settings
-            } else {
 
-                // Get member list sorted as specified
-                switch ($this->config['settings']['list_order_list']) {
+                if ($start + $limit <= $filteredMembersFound) {
+                    $nextStart = $start + $limit;
+                }
 
-                    // Pseudo-Random list order
-                    case $this->config['sort_order_numb']['Pseudo-Random']:
-                        ${$resultParam} = $this->getList($where.$alphaWhere, 'pseudo-random', true, 'id', $start, $limit);
-                        break;
+                // since we're doing paging, we have to break out just the member data
+                $list = $listResult['list'];
+                unset($listResult);
 
-                        // Random list order
-                    case $this->config['sort_order_numb']['Random']:
-                        ${$resultParam} = $this->getList($where.$alphaWhere, 'random', true, 'id', $start, $limit);
-                        break;
+            }
 
-                    // Default is alpha-numeric list order
-                    default:
-                    case $this->config['sort_order_numb']['Alpha-Numeric']:
-                        $sortOrder = apply_filters( 'glm-member-db-front-search-query-orderby', 'member_name' );
-                        ${$resultParam} = $this->getList($where.$alphaWhere, $sortOrder, true, 'id', $start, $limit);
-                        break;
+            // If we have list entries - even if it's an empty list
+            $success = true;
+            $haveMembers = false;
+            if (!$blankStart && $list !== false) {
+
+                $success = true;
 
+                // If we have any entries
+                if (count($list) > 0) {
+                    $haveMembers = true;
                 }
             }
 
-        }
-
-        if ($paging) {
+            // If there's only one category for the search picklist
+            $singleCategory = false;
+            if (count($categoryData) == 1) {
+                $singleCategory = true;
+            }
 
-            // Get paging results - With paging getList() returns an array with additional paging data
-            $numbDisplayed = $listResult['returned'];
-            $lastDisplayed = $listResult['last'];
-            if ($start == 1) {
-                $prevStart = false;
-            } else {
-                $prevStart = $start - $limit;
-                if ($start < 1) {
-                    $start = 1;
+            // Setup ajax Request
+            $ajaxRequest = '';
+            if ( isset( $memberType ) && $memberType ) {
+                $ajaxRequest .= "&memberType=$memberType";
+            }
+            if ( isset( $categorySearch ) && $categorySearch ) {
+                $ajaxRequest .= "&categorySearch=$categorySearch";
+            }
+            if ( isset( $citySearch ) && $citySearch ) {
+                $ajaxRequest .= "&citySearch=$citySearch";
+            }
+            if ( isset( $ajaxRequest ) && $ajaxRequest ) {
+                $ajaxRequest .= "&ajaxRequest=$ajaxRequest";
+            }
+            if ( isset( $view ) && $view ) {
+                $ajaxRequest .= "&view=$view";
+            }
+            if ( isset( $blankStart ) && $blankStart ) {
+                $ajaxRequest .= "&blankStart=$blankStart";
+            }
+            if ( isset( $catSelected ) && $catSelected ) {
+                $ajaxRequest .= "&catSelected=$catSelected";
+            }
+            if ( isset( $_REQUEST['textSearch'] ) ) {
+                $ajaxRequest .= "&textSearch=" . urlencode( stripslashes( $textSearch ) );
+            }
+            if ( isset( $actionData['request']['category'] ) ) {
+                $catsRequested = explode( ',', $actionData['request']['category'] );
+                if ( $catsRequested ) {
+                    foreach ( $catsRequested as $cats ) {
+                        $ajaxRequest .= "&categorySearchMultiple[]=" . $cats;
+                    }
                 }
             }
-
-            if ($start + $limit <= $filteredMembersFound) {
-                $nextStart = $start + $limit;
+            if ( isset( $_REQUEST['categorySearch'] ) && $_REQUEST['categorySearch'] ) {
+                $ajaxRequest .= '&categorySearch=' . $_REQUEST['categorySearch'];
+            }
+            if ( isset( $_REQUEST['cityUserSearch'] ) && is_array( $_REQUEST['cityUserSearch'] ) && !empty( $_REQUEST['cityUserSearch'] ) ) {
+                foreach ( $_REQUEST['cityUserSearch'] as $cityId ) {
+                    $ajaxRequest .= "&cityUserSearch[]=$cityId";
+                }
+            }
+            if ( isset( $_REQUEST['regionUserSearch'] ) && is_array( $_REQUEST['regionUserSearch'] ) && !empty( $_REQUEST['regionUserSearch'] ) ) {
+                foreach ( $_REQUEST['regionUserSearch'] as $regionId ) {
+                    $ajaxRequest .= "&regionUserSearch[]=$regionId";
+                }
             }
 
-            // since we're doing paging, we have to break out just the member data
-            $list = $listResult['list'];
-            unset($listResult);
+        } // not have query completed
 
-        }
+        /*
+         * Keep track of what's been done on the page.
+         *
+         * For the time being, we can only have one of each section (map, search, list) on a page. We should
+         * fix this when possible, but that will take serializing the various IDs that would otherwise
+         * be duplicated.
+         *
+         * If a section has already been output and is called again, it will be replaced with an error message on the page.
+         */
 
-        // If we have list entries - even if it's an empty list
-        $success = true;
-        $haveMembers = false;
-        if (!$blankStart && $list !== false) {
+        $thisInstance['instanceCount']++;
 
-            $success = true;
+        // Check Map
+        if ($settings['list_show_map']) {
 
-            // If we have any entries
-            if (count($list) > 0) {
-                $haveMembers = true;
-            }
-        }
+            // If map has already been displayed
+            if ($thisInstance['mapDisplayed']) {
+                $messages[] = 'WARNING: Map may only be displayed once on this page! - Shorcode Instance #'.$thisInstance['instanceCount'];
+                $settings['list_show_map'] = false;
+            } else {
 
-        // If there's only one category for the search picklist
-        $singleCategory = false;
-        if (count($categoryData) == 1) {
-            $singleCategory = true;
-        }
+                $thisInstance['mapDisplayed'] = true;
+
+                // Enqueue the Marker Clusterer Script
+                wp_register_script(
+                        'glm-members-admin-google-maps-marker-clusterer',
+                        GLM_MEMBERS_PLUGIN_URL . 'js/googleMapsMarkerClusterer/markerclustererplus.js',
+                        array(
+                            'jquery'
+                        ),
+                        GLM_MEMBERS_PLUGIN_VERSION
+                        );
+                wp_enqueue_script('glm-members-admin-google-maps-marker-clusterer', false, array('jquery'), false, true);
 
-        // Setup ajax Request
-        $ajaxRequest = '';
-        if ( isset( $memberType ) && $memberType ) {
-            $ajaxRequest .= "&memberType=$memberType";
-        }
-        if ( isset( $categorySearch ) && $categorySearch ) {
-            $ajaxRequest .= "&categorySearch=$categorySearch";
-        }
-        if ( isset( $citySearch ) && $citySearch ) {
-            $ajaxRequest .= "&citySearch=$citySearch";
-        }
-        if ( isset( $ajaxRequest ) && $ajaxRequest ) {
-            $ajaxRequest .= "&ajaxRequest=$ajaxRequest";
-        }
-        if ( isset( $view ) && $view ) {
-            $ajaxRequest .= "&view=$view";
-        }
-        if ( isset( $blankStart ) && $blankStart ) {
-            $ajaxRequest .= "&blankStart=$blankStart";
-        }
-        if ( isset( $catSelected ) && $catSelected ) {
-            $ajaxRequest .= "&catSelected=$catSelected";
-        }
-        if ( isset( $_REQUEST['textSearch'] ) ) {
-            $ajaxRequest .= "&textSearch=" . urlencode( stripslashes( $textSearch ) );
-        }
-        if ( isset( $actionData['request']['category'] ) ) {
-            $catsRequested = explode( ',', $actionData['request']['category'] );
-            if ( $catsRequested ) {
-                foreach ( $catsRequested as $cats ) {
-                    $ajaxRequest .= "&categorySearchMultiple[]=" . $cats;
-                }
             }
         }
-        if ( isset( $_REQUEST['categorySearch'] ) && $_REQUEST['categorySearch'] ) {
-            $ajaxRequest .= '&categorySearch=' . $_REQUEST['categorySearch'];
-        }
-        if ( isset( $_REQUEST['cityUserSearch'] ) && is_array( $_REQUEST['cityUserSearch'] ) && !empty( $_REQUEST['cityUserSearch'] ) ) {
-            foreach ( $_REQUEST['cityUserSearch'] as $cityId ) {
-                $ajaxRequest .= "&cityUserSearch[]=$cityId";
+
+        // Check Search
+        if ($settings['list_show_search']) {
+
+            // If a search box has already been displayed
+            if ($thisInstance['searchDisplayed']) {
+                $messages[] = 'WARNING: Search form may only be displayed once on this page! - Shorcode Instance #'.$thisInstance['instanceCount'];
+                $settigns['list_show_search'] = false;
+            } else {
+                $thisInstance['searchDisplayed'] = true;
             }
+
         }
-        if ( isset( $_REQUEST['regionUserSearch'] ) && is_array( $_REQUEST['regionUserSearch'] ) && !empty( $_REQUEST['regionUserSearch'] ) ) {
-            foreach ( $_REQUEST['regionUserSearch'] as $regionId ) {
-                $ajaxRequest .= "&regionUserSearch[]=$regionId";
+
+        // Check List
+        if ($settings['list_show_list']) {
+
+            // If a search box has already been displayed
+            if ($thisInstance['listDisplayed']) {
+                $messages[] = 'WARNING: Search form may only be displayed once on this page! - Shorcode Instance #'.$thisInstance['instanceCount'];
+                $settigns['list_show_list'] = false;
+            } else {
+                $thisInstance['listDisplayed'] = true;
             }
+
         }
 
         // echo "<pre>Settings at End".print_r($settings,1)."</pre>";
 
         // Compile template data
         $templateData = array(
+            'messages'             => $messages,
+            'haveMessages'         => count($messages) > 0,
             'showSettings'         => $settings,
             'haveMembers'          => $haveMembers,
             'members'              => $list,
index 9bf30a8..1c5aee1 100644 (file)
@@ -119,11 +119,15 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) {
                 'search-text'           => 'list_show_search_text',
                 'search-categories'     => 'list_show_search_category',
                 'search-amenities'      => 'list_show_search_amenities',
+                'search-region'         => 'list_show_search_region',
                 'search-alpha'          => 'list_show_search_alpha',
+                'search-city'           => 'list_show_search_city',
+                'search-floating'       => 'list_floating_search',
                 'list'                  => 'list_show_list',
                 'name-link'             => 'list_show_detail_link',
                 'logo'                  => 'list_show_logo',
                 'logo-filler'           => 'list_show_logo_filler',
+                'logo-for-mobile'       => 'list_logo_for_mobile',
                 'address'               => 'list_show_address',
                 'street'                => 'list_show_street',
                 'city-state-zip'        => 'list_show_citystatezip',
@@ -139,6 +143,8 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) {
                 'categories'            => 'list_show_categroies',
                 'credit-cards'          => 'list_show_creditcards',
                 'amenities'             => 'list_show_amenities',
+                'logo-filler'           => 'list_show_logo_filler',
+                'live-cam'              => 'list_show_live_cam',
                 'amenity-groups'        => 'amenity-groups',
                 'packages'              => 'list_show_packages',
                 'packages-link'         => 'list_show_packages_link',
@@ -403,6 +409,10 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) {
                 "-" in front of them and should be the first item in the comma separated
                 list. These can be used to turn all content on or turn all content off. Any
                 items listed after this will add or remove those items from being displayed.
+                Note that if you use "none" then add a section (i.e. map, search, list) that
+                you will also have to add every item under that section that you need. The
+                better way to do that is to not use "none" and use something like
+                "-search,-list" if you just want a map.
                 </p>
                 <p>
                 The only content that may not be disabled is the member name. This will always
@@ -442,15 +452,19 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) {
                         <span>search-text</span>
                         <span>search-categories</span>
                         <span>search-amenities</span>
+                        <span>search-region</span>
                         <span>search-alpha</span>
+                        <span>search-city</span>
                         <span>search-filters-opened</span>
                         <span>logo-filler</span>
+                        <span>search-floating</span>
             </p>
                 <p class="shortcode-option-list">
                     <span class="shortcode-option-list-title">Member List Options</span><br>
                         <span>list</span>
                         <span>name-link</span>
                         <span>logo</span>
+                        <span>logo-for-mobile</span>
                         <span>address</span>
                         <span>street</span>
                         <span>city-state-zip</span>
@@ -466,6 +480,8 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) {
                         <span>categories</span>
                         <span>credit-cards</span>
                         <span>amenities</span>
+                        <span>logo-filler</span>
+                        <span>live-cam</span>
                         <span>packages</span>
                         <span>packages-link</span>
             </p>
index ad242cd..8ee6c46 100755 (executable)
-{if $showSettings.list_show_outer_container}
-
-    {include file='front/members/header.html'}
-
-
-    <div class="glm-member-db-list glm-member-db-{$view}-view
-        {if $showSettings.list_map_show_opened || $view == 'map'}map-opened {else}map-closed {/if}
-        {if $showSettings.list_show_search_filters_opened}filters-opened{else}filters-closed{/if}
-    ">
-{/if}
-        {apply_filters('glm-member-db-front-members-list-pageTop', '')}
-
-{if $showSettings.list_map_show_container}
-        <div class="glm-member-list-inner-wrapper">
-{/if}
-
-        {if $showSettings.list_show_map}
-
-            {if $settings.selected_map_interface == 1}
-                {* Leaflet Map *}
-                <link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.3/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin=""/>
-                <script src="https://unpkg.com/leaflet@1.3.3/dist/leaflet.js" integrity="sha512-tAGcCfR4Sc5ZP5ZoVz0quoZDYX5aCtEm/eu1KhSLj2c9eFrylXZknQYmxUssFaVJKvvc0dJQixhGjG2yXWiV9Q==" crossorigin=""></script>
-                <link rel="stylesheet" href="{$jsUrl}/LeafletMarkerCluster/dist/MarkerCluster.Default.css" />
-                <script src="{$jsUrl}/LeafletMarkerCluster/dist/leaflet.markercluster-src.js"></script>
-                <link rel="stylesheet" href="{$jsUrl}/Leaflet.loading/src/Control.Loading.css" />
-                <script src="{$jsUrl}/Leaflet.loading/src/Control.Loading.js"></script>
-                <link rel="stylesheet" href="//unpkg.com/leaflet-gesture-handling/dist/leaflet-gesture-handling.min.css" type="text/css">
-                <script src="//unpkg.com/leaflet-gesture-handling"></script>
-            {/if}
-            {if $settings.selected_map_interface == 2}
-                {* Google Map *}
-                <script src="//maps.googleapis.com/maps/api/js?&key={$settings.google_maps_api_key}"></script>
-            {/if}
-
-            {if $showSettings.list_map_show_button}
-                <div id="glm-member-list-map-toggle" class="button glm-button">View Map</div>
-            {/if}
-
-        {/if} {* list_show_map *}
-
-        {if $showSettings.list_show_search}
-
-            <div id="glm-member-list-filters-wrapper">
-                {if $showSettings.list_search_show_button}
-                    <div id="glm-member-list-filters-button" class="button glm-button glm-member-list-filters-toggle">
-                        FILTERS
-                    </div>
+{if $haveMessages}
+
+    <div style="color: red !important;">
+        <h2>WARNING:</h2>
+        <ul>
+            {foreach $messages as $m}
+                <li>{$m}</li>
+            {/foreach}
+        </ul>
+    </div>
+
+{else}
+
+
+    {if $showSettings.list_show_outer_container}
+
+        {include file='front/members/header.html'}
+
+
+        <div class="glm-member-db-list glm-member-db-{$view}-view
+            {if $showSettings.list_map_show_opened || $view == 'map'}map-opened {else}map-closed {/if}
+            {if $showSettings.list_show_search_filters_opened}filters-opened{else}filters-closed{/if}
+        ">
+    {/if}
+            {apply_filters('glm-member-db-front-members-list-pageTop', '')}
+
+    {if $showSettings.list_map_show_container}
+            <div class="glm-member-list-inner-wrapper">
+    {/if}
+
+            {if $showSettings.list_show_map}
+
+                {if $settings.selected_map_interface == 1}
+                    {* Leaflet Map *}
+                    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.3/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin=""/>
+                    <script src="https://unpkg.com/leaflet@1.3.3/dist/leaflet.js" integrity="sha512-tAGcCfR4Sc5ZP5ZoVz0quoZDYX5aCtEm/eu1KhSLj2c9eFrylXZknQYmxUssFaVJKvvc0dJQixhGjG2yXWiV9Q==" crossorigin=""></script>
+                    <link rel="stylesheet" href="{$jsUrl}/LeafletMarkerCluster/dist/MarkerCluster.Default.css" />
+                    <script src="{$jsUrl}/LeafletMarkerCluster/dist/leaflet.markercluster-src.js"></script>
+                    <link rel="stylesheet" href="{$jsUrl}/Leaflet.loading/src/Control.Loading.css" />
+                    <script src="{$jsUrl}/Leaflet.loading/src/Control.Loading.js"></script>
+                    <link rel="stylesheet" href="//unpkg.com/leaflet-gesture-handling/dist/leaflet-gesture-handling.min.css" type="text/css">
+                    <script src="//unpkg.com/leaflet-gesture-handling"></script>
                 {/if}
-                <div id="glm-member-list-filters-box">
+                {if $settings.selected_map_interface == 2}
+                    {* Google Map *}
+                    <script src="//maps.googleapis.com/maps/api/js?&key={$settings.google_maps_api_key}"></script>
+                {/if}
+
+                {if $showSettings.list_map_show_button}
+                    <div id="glm-member-list-map-toggle" class="button glm-button">View Map</div>
+                {/if}
+
+            {/if} {* list_show_map *}
+
+            {if $showSettings.list_show_search}
+
+                <div id="glm-member-list-filters-wrapper">
                     {if $showSettings.list_search_show_button}
-                        <div id="glm-member-list-filters-close" class="button glm-button glm-member-list-filters-toggle">Close</div>
+                        <div id="glm-member-list-filters-button" class="button glm-button glm-member-list-filters-toggle">
+                            FILTERS
+                        </div>
                     {/if}
-                    <form action="{$thisUrl}?glm_action=list#glm-member-list-filters-button" method="post" enctype="multipart/form-data">
-                        {if isset($smarty.request.s)}<input type="hidden" name="s" value="{$smarty.request.s|escape}">{/if}
-                        <div class="glma-small-12 glma-columns glm-member-search glm-member-entry-container glm-member-container">
-                            {apply_filters('glm-member-db-front-members-list-searchFormTop', '')}
-                            <div>
-                                <h3>Refine Search</h3>
-                            </div>
-                            {if $showSettings.list_show_search_category}
+                    <div id="glm-member-list-filters-box">
+                        {if $showSettings.list_search_show_button}
+                            <div id="glm-member-list-filters-close" class="button glm-button glm-member-list-filters-toggle">Close</div>
+                        {/if}
+                        <form action="{$thisUrl}?glm_action=list#glm-member-list-filters-button" method="post" enctype="multipart/form-data">
+                            {if isset($smarty.request.s)}<input type="hidden" name="s" value="{$smarty.request.s|escape}">{/if}
+                            <div class="glma-small-12 glma-columns glm-member-search glm-member-entry-container glm-member-container">
+                                {apply_filters('glm-member-db-front-members-list-searchFormTop', '')}
                                 <div>
-                                    By Category:
-                                    <select name="categorySearch" id="categorySelect">
-                                        {if !$singleCategory}
-                                            <option value="">(all)</option>
-                                        {/if}
-                                        {foreach from=$categories item=v}
-                                            <option value="{$v.id}"{if $v.default} selected="selected"{/if}>
-                                                {if $v.parent}&nbsp;&nbsp;&nbsp;&nbsp;{/if}{$v.name}
-                                            </option>
-                                        {/foreach}
-                                    </select>
+                                    <h3>Refine Search</h3>
                                 </div>
-                            {/if} {* list_show_search_category *}
-
-                            {if $showSettings.list_show_search_amenities}
-                                {if $amenities|@count gt 0}
+                                {if $showSettings.list_show_search_category}
                                     <div>
-                                        By Amenities:
-                                        <select name="amenitySearch[]" id="amenitySelect" title="Click to Select Amenities" multiple="multiple">
-                                            {foreach from=$amenities item=v}
-                                                <option value="{$v.id}" {if $v.default} selected="selected"{/if}>
-                                                    {$v.name}
-                                                </option>
-                                            {/foreach}
-                                        </select>
-                                    </div>
-                                {/if}
-                            {/if} {* list_show_search_amenities *}
-
-                            {if $showSettings.list_show_search_region}
-                                {if $regions|@count gt 0}
-                                    <div>
-                                        By Regions:
-                                        <select name="regionUserSearch[]">
-                                            {if $regions|@count gt 1}
-                                                <option value"">(all)</option>
+                                        By Category:
+                                        <select name="categorySearch" id="categorySelect">
+                                            {if !$singleCategory}
+                                                <option value="">(all)</option>
                                             {/if}
-                                            {foreach from=$regions item=v}
-                                                <option value="{$v.id}" {if $v.default} selected="selected"{/if}>
-                                                    {$v.name}
+                                            {foreach from=$categories item=v}
+                                                <option value="{$v.id}"{if $v.default} selected="selected"{/if}>
+                                                    {if $v.parent}&nbsp;&nbsp;&nbsp;&nbsp;{/if}{$v.name}
                                                 </option>
                                             {/foreach}
                                         </select>
                                     </div>
-                                {/if}
-                            {/if} {* list_show_search_region *}
+                                {/if} {* list_show_search_category *}
+
+                                {if $showSettings.list_show_search_amenities}
+                                    {if $amenities|@count gt 0}
+                                        <div>
+                                            By Amenities:
+                                            <select name="amenitySearch[]" id="amenitySelect" title="Click to Select Amenities" multiple="multiple">
+                                                {foreach from=$amenities item=v}
+                                                    <option value="{$v.id}" {if $v.default} selected="selected"{/if}>
+                                                        {$v.name}
+                                                    </option>
+                                                {/foreach}
+                                            </select>
+                                        </div>
+                                    {/if}
+                                {/if} {* list_show_search_amenities *}
+
+                                {if $showSettings.list_show_search_region}
+                                    {if $regions|@count gt 0}
+                                        <div>
+                                            By Regions:
+                                            <select name="regionUserSearch[]">
+                                                {if $regions|@count gt 1}
+                                                    <option value"">(all)</option>
+                                                {/if}
+                                                {foreach from=$regions item=v}
+                                                    <option value="{$v.id}" {if $v.default} selected="selected"{/if}>
+                                                        {$v.name}
+                                                    </option>
+                                                {/foreach}
+                                            </select>
+                                        </div>
+                                    {/if}
+                                {/if} {* list_show_search_region *}
+
+                                {if $showSettings.list_show_search_city}
+                                    {if $cities|@count gt 0}
+                                        <div>
+                                            By Cities:
+                                            <select name="cityUserSearch[]">
+                                                {if $cities|@count gt 1}
+                                                    <option value"">(all)</option>
+                                                {/if}
+                                                {foreach from=$cities item=v}
+                                                    <option value="{$v.id}" {if $v.default} selected="selected"{/if}>
+                                                        {$v.name}
+                                                    </option>
+                                                {/foreach}
+                                            </select>
+                                        </div>
+                                    {/if}
+                                {/if} {* list_show_search_city *}
+
+                                {if $showSettings.list_show_search_text}
 
-                            {if $showSettings.list_show_search_city}
-                                {if $cities|@count gt 0}
                                     <div>
-                                        By Cities:
-                                        <select name="cityUserSearch[]">
-                                            {if $cities|@count gt 1}
-                                                <option value"">(all)</option>
-                                            {/if}
-                                            {foreach from=$cities item=v}
-                                                <option value="{$v.id}" {if $v.default} selected="selected"{/if}>
-                                                    {$v.name}
-                                                </option>
-                                            {/foreach}
-                                        </select>
+                                        By Name: <input type="text" name="textSearch" value="{$textSearch}" class="glm-form-text-input">
                                     </div>
                                 {/if}
-                            {/if} {* list_show_search_city *}
-
-                            {if $showSettings.list_show_search_text}
-
-                                <div>
-                                    By Name: <input type="text" name="textSearch" value="{$textSearch}" class="glm-form-text-input">
-                                </div>
-                            {/if}
-                            <div><input class="button glm-member-button centered" type="submit" value="Search"></div>
-                            {apply_filters('glm-member-db-front-members-list-searchFormBottom', '')}
-                        </div>
-                    </form>
-                </div> {* glm-member-list-filters-box *}
-            </div> {* glm-member-list-filters-wrapper *}
+                                <div><input class="button glm-member-button centered" type="submit" value="Search"></div>
+                                {apply_filters('glm-member-db-front-members-list-searchFormBottom', '')}
+                            </div>
+                        </form>
+                    </div> {* glm-member-list-filters-box *}
+                </div> {* glm-member-list-filters-wrapper *}
 
-        {/if} {* list_show_search *}
+            {/if} {* list_show_search *}
 
-        {if $showSettings.list_show_map}
-            {apply_filters('glm-member-db-front-members-list-mapTop', '')}
-            <div id="glm-locationMap-container">
-                {if $settings.selected_map_interface == 1}
-                    {* Leaflet Map *}
-                    <div id="LeafletMapContainer" style="height: 400px; width: 100%; border: 1px black solid; z-index: +0; margin: 0 auto;"></div>
-                {/if}
-                {if $settings.selected_map_interface == 2}
-                    {* Google Map *}
-                    <div id="glm-locationMap" class="glm-map">(map loads here)</div>
-                {/if}
-            </div>
-            {apply_filters('glm-member-db-front-members-list-mapBottom', '')}
+            {if $showSettings.list_show_map}
+                {apply_filters('glm-member-db-front-members-list-mapTop', '')}
+                <div id="glm-locationMap-container">
+                    {if $settings.selected_map_interface == 1}
+                        {* Leaflet Map *}
+                        <div id="LeafletMapContainer" style="height: 400px; width: 100%; border: 1px black solid; z-index: +0; margin: 0 auto;"></div>
+                    {/if}
+                    {if $settings.selected_map_interface == 2}
+                        {* Google Map *}
+                        <div id="glm-locationMap" class="glm-map">(map loads here)</div>
+                    {/if}
+                </div>
+                {apply_filters('glm-member-db-front-members-list-mapBottom', '')}
 
-            {* Member information displayed in map bubbles *}
+                {* Member information displayed in map bubbles *}
 
-            {foreach $mapItems as $m}
-                <div id="map_info_{$m.id}" class="glm-hidden">
-                    {apply_filters('glm-member-db-front-members-list-mapBubbleTop', '', $m.member)}
-                    {if $m.logo && $showSettings.list_map_show_logo}
-                        <div class="glm-member-list-image">
-                            <img src="{$glmPluginMediaUrl}/images/{$settings.list_map_logo_size}/{$m.logo}">
-                        </div>
-                    {/if}
-                    <div class="glm-map-member-name">
-                        {if $showSettings.list_map_show_detaillink && !$m.has_no_profile}
-                                <a href="{$siteBaseUrl}{$settings.canonical_member_page}/{$m.member_slug}/{if $settings.enable_multiple_profiles}{$m.id}/{/if}">{$m.member_name}</a>
-                        {else}
-                                {$m.member_name}
+                {foreach $mapItems as $m}
+                    <div id="map_info_{$m.id}" class="glm-hidden">
+                        {apply_filters('glm-member-db-front-members-list-mapBubbleTop', '', $m.member)}
+                        {if $m.logo && $showSettings.list_map_show_logo}
+                            <div class="glm-member-list-image">
+                                <img src="{$glmPluginMediaUrl}/images/{$settings.list_map_logo_size}/{$m.logo}">
+                            </div>
                         {/if}
-                    </div>
-                    {if $showSettings.list_map_show_address}
-                        <p class="glm-map-member-address">
-                            {if $showSettings.list_map_show_street}
-                                {if $m.addr1}{$m.addr1}<br>{/if}
-                                {if $m.addr2}{$m.addr2}<br>{/if}
-                            {/if}
-                            {if $settings.memb_info_location && $showSettings.list_map_show_citystatezip}
-                                {if $m.city}{$m.city}{if $m.state}, {/if}{/if}{if $m.state}{$m.state}{/if}{if $m.zip} {$m.zip}{/if}
+                        <div class="glm-map-member-name">
+                            {if $showSettings.list_map_show_detaillink && !$m.has_no_profile}
+                                    <a href="{$siteBaseUrl}{$settings.canonical_member_page}/{$m.member_slug}/{if $settings.enable_multiple_profiles}{$m.id}/{/if}">{$m.member_name}</a>
+                            {else}
+                                    {$m.member_name}
                             {/if}
-                            {if $m.country && $showSettings.list_map_show_country}
-                                {$m.country}
+                        </div>
+                        {if $showSettings.list_map_show_address}
+                            <p class="glm-map-member-address">
+                                {if $showSettings.list_map_show_street}
+                                    {if $m.addr1}{$m.addr1}<br>{/if}
+                                    {if $m.addr2}{$m.addr2}<br>{/if}
+                                {/if}
+                                {if $settings.memb_info_location && $showSettings.list_map_show_citystatezip}
+                                    {if $m.city}{$m.city}{if $m.state}, {/if}{/if}{if $m.state}{$m.state}{/if}{if $m.zip} {$m.zip}{/if}
+                                {/if}
+                                {if $m.country && $showSettings.list_map_show_country}
+                                    {$m.country}
+                                {/if}
+                            </p>
+                        {/if} {* list_map_show_address *}
+
+                        <div class="glm-member-list-info">
+                            <p class="glm-member-list-map-info">
+                                {if $m.phone && $showSettings.list_map_show_phone}<b>Phone:</b> <a href="tel:{apply_filters('glm_associate_phone_filter_tel', $m.phone)}">{apply_filters('glm_associate_phone_filter', $m.phone)}</a><br>{/if}
+                                {if $m.toll_free && $showSettings.list_map_show_tollfree}<a href="tel:{apply_filters('glm_associate_phone_filter_tel', $m.toll_free)}">{apply_filters('glm_associate_phone_filter', $m.toll_free)}</a><br>{/if}
+                                {if $m.email && $showSettings.list_map_show_email}<b>E-Mail Address:</b> <a href="mailto:{$m.email}">{$m.email}</a><br>{/if}
+                                {if $m.region && $showSettings.list_map_show_region}<b>Region:</b> {$m.region}<br>{/if}
+                                {if $m.url && $showSettings.list_map_show_url}<a href="{$m.url}"{if $showSettings.list_map_show_url_newtarget} target="_blank"{/if}>Website</a><br>{/if}
+                            </p>
+                            {if isset($m.descr) && $showSettings.list_map_show_descr}{$m.descr|nl2br}<br>{/if}
+                            {if $m.short_descr && $showSettings.list_map_show_short_descr}{$m.short_descr|truncate:200}<br>{/if}
+                            {if $showSettings.list_map_show_detaillink && !$m.has_no_profile}
+                                <a href="{$siteBaseUrl}{$settings.canonical_member_page}/{$m.member_slug}/{if $settings.enable_multiple_profiles}{$m.id}/{/if}">More Info</a>
                             {/if}
-                        </p>
-                    {/if} {* list_map_show_address *}
-
-                    <div class="glm-member-list-info">
-                        <p class="glm-member-list-map-info">
-                            {if $m.phone && $showSettings.list_map_show_phone}<b>Phone:</b> <a href="tel:{apply_filters('glm_associate_phone_filter_tel', $m.phone)}">{apply_filters('glm_associate_phone_filter', $m.phone)}</a><br>{/if}
-                            {if $m.toll_free && $showSettings.list_map_show_tollfree}<a href="tel:{apply_filters('glm_associate_phone_filter_tel', $m.toll_free)}">{apply_filters('glm_associate_phone_filter', $m.toll_free)}</a><br>{/if}
-                            {if $m.email && $showSettings.list_map_show_email}<b>E-Mail Address:</b> <a href="mailto:{$m.email}">{$m.email}</a><br>{/if}
-                            {if $m.region && $showSettings.list_map_show_region}<b>Region:</b> {$m.region}<br>{/if}
-                            {if $m.url && $showSettings.list_map_show_url}<a href="{$m.url}"{if $showSettings.list_map_show_url_newtarget} target="_blank"{/if}>Website</a><br>{/if}
-                        </p>
-                        {if isset($m.descr) && $showSettings.list_map_show_descr}{$m.descr|nl2br}<br>{/if}
-                        {if $m.short_descr && $showSettings.list_map_show_short_descr}{$m.short_descr|truncate:200}<br>{/if}
-                        {if $showSettings.list_map_show_detaillink && !$m.has_no_profile}
-                            <a href="{$siteBaseUrl}{$settings.canonical_member_page}/{$m.member_slug}/{if $settings.enable_multiple_profiles}{$m.id}/{/if}">More Info</a>
-                        {/if}
-                        {if isset($m.categories) && $showSettings.list_map_show_categories}
-                            <div class="glm-member-list-items">
-                                <b>{$terms.term_member_cap} Categories</b>
-                                <ul>
-                                    {if isset($m.categories)}
-                                        {foreach $m.categories as $c}
-                                            <li>
-                                                {if $c.parent_name}{$c.parent_name}: {/if}{$c.name}
-                                            </li>
+                            {if isset($m.categories) && $showSettings.list_map_show_categories}
+                                <div class="glm-member-list-items">
+                                    <b>{$terms.term_member_cap} Categories</b>
+                                    <ul>
+                                        {if isset($m.categories)}
+                                            {foreach $m.categories as $c}
+                                                <li>
+                                                    {if $c.parent_name}{$c.parent_name}: {/if}{$c.name}
+                                                </li>
+                                            {/foreach}
+                                        {/if}
+                                    </ul>
+                                </div>
+                            {/if} {* categories *}
+
+
+                            {* Not using credit cards for now  {literal}
+                                {if $m.cc_type && $showSettings.list_map_show_creditcards}
+                                    <div class="glm-member-list-items">
+                                        <b>Credit Cards Accepted:</b>
+                                        <ul>
+                                    {if isset($m.cc_type)}
+                                        {foreach $m.cc_type.names as $c}
+                                            <li>{$c}</li>
                                         {/foreach}
                                     {/if}
-                                </ul>
-                            </div>
-                        {/if} {* categories *}
+                                        </ul>
+                                    </div>
+                                {/if}
+                            {/literal} *}
 
 
-                        {* Not using credit cards for now  {literal}
-                            {if $m.cc_type && $showSettings.list_map_show_creditcards}
+                            {if $showSettings.list_map_show_amenities}
                                 <div class="glm-member-list-items">
-                                    <b>Credit Cards Accepted:</b>
+                                    <b>Amenities:</b>
                                     <ul>
-                                {if isset($m.cc_type)}
-                                    {foreach $m.cc_type.names as $c}
-                                        <li>{$c}</li>
+                                {if isset($m.amenities)}
+                                    {foreach $m.amenities as $a}
+                                        <li>{$a.name}</li>
                                     {/foreach}
                                 {/if}
                                     </ul>
                                 </div>
                             {/if}
-                        {/literal} *}
+                        </div>
+                        {apply_filters('glm-member-db-front-members-list-mapBubbleBottom', '', $m.member)}
+                    </div> <!-- End of information displayed in map bubbles -->
 
+                {/foreach} {* mapItems *}
 
-                        {if $showSettings.list_map_show_amenities}
-                            <div class="glm-member-list-items">
-                                <b>Amenities:</b>
-                                <ul>
-                            {if isset($m.amenities)}
-                                {foreach $m.amenities as $a}
-                                    <li>{$a.name}</li>
-                                {/foreach}
-                            {/if}
-                                </ul>
-                            </div>
-                        {/if}
-                    </div>
-                    {apply_filters('glm-member-db-front-members-list-mapBubbleBottom', '', $m.member)}
-                </div> <!-- End of information displayed in map bubbles -->
-
-            {/foreach} {* mapItems *}
+            {/if} {* list_show_map *}
 
-        {/if} {* list_show_map *}
+            {apply_filters('glm-member-db-front-members-list-listHeaderTop', '')}
 
-        {apply_filters('glm-member-db-front-members-list-listHeaderTop', '')}
+            {if $haveFeaturedMembers}
 
-        {if $haveFeaturedMembers}
+                <h3 id="glm-featured-members-title">Featured</h3>
 
-            <h3 id="glm-featured-members-title">Featured</h3>
+                <ul id="glm-featured-members-grid" class="featured-grid glma-small-block-grid-1 glma-medium-block-grid-2 glma-large-block-grid-3">
+                {foreach $featuredMembers as $fm}
+                    <li class="featured-grid-item-wrapper">
+                        <a class="featured-grid-item" href="{$siteBaseUrl}{$settings.canonical_member_page}/{$fm.member_slug}/">
+                    {if $fm.logo && $showSettings.list_show_logo}
+                            <div class="glm-member-list-has-image">
+                                <img class="glm-member-list-image" src="{$glmPluginMediaUrl}/images/grid/{$fm.logo}">
+                            </div>
+                    {elseif $showSettings.list_show_logo_filler}
+                            <div class="glm-member-list-has-image">
+                                <img class="glm-member-list-image-filler" src="{$assetsUrl}/filler_s.gif">
+                            </div>
+                    {else}
+                            <div class="glm-member-list-missing-image"></div>
+                    {/if}
+                            <div class="featured-grid-item-info">
+                                <h4 class="featured-member-title">{$fm.member_name}</h4>
 
-            <ul id="glm-featured-members-grid" class="featured-grid glma-small-block-grid-1 glma-medium-block-grid-2 glma-large-block-grid-3">
-            {foreach $featuredMembers as $fm}
-                <li class="featured-grid-item-wrapper">
-                    <a class="featured-grid-item" href="{$siteBaseUrl}{$settings.canonical_member_page}/{$fm.member_slug}/">
-                {if $fm.logo && $showSettings.list_show_logo}
-                        <div class="glm-member-list-has-image">
-                            <img class="glm-member-list-image" src="{$glmPluginMediaUrl}/images/grid/{$fm.logo}">
-                        </div>
-                {elseif $showSettings.list_show_logo_filler}
-                        <div class="glm-member-list-has-image">
-                            <img class="glm-member-list-image-filler" src="{$assetsUrl}/filler_s.gif">
-                        </div>
+                                {if $fm.short_descr && $settings.list_show_short_descr}
+                                    <div class="featured-member-description">
+                                        {$fm.short_descr|nl2br}
+                                    </div>
+                                {/if}
+                            </div>
+                        </a>
+                    </li>
+                {/foreach} {* featuredMembers *}
+                </ul>
+
+            {/if} {* haveFeaturedMembers *}
+
+            {if $showSettings.list_show_list && !$blankStart}
+                {if $settings.list_header_text}
+                <h3 class="glm-member-db-list-header-title">{$settings.list_header_text}</h3>
+                {elseif apply_filters('is_page', 'search')}
+                <h1 class="glm-member-db-list-header-title member-search-page-title">List of {$terms.term_member_plur_cap}</h1>
                 {else}
-                        <div class="glm-member-list-missing-image"></div>
+                <h3 class="glm-member-db-list-header-title">List of {$terms.term_member_plur_cap}</h3>
                 {/if}
-                        <div class="featured-grid-item-info">
-                            <h4 class="featured-member-title">{$fm.member_name}</h4>
+                {if $haveMembers}
 
-                            {if $fm.short_descr && $settings.list_show_short_descr}
-                                <div class="featured-member-description">
-                                    {$fm.short_descr|nl2br}
-                                </div>
-                            {/if}
-                        </div>
-                    </a>
-                </li>
-            {/foreach} {* featuredMembers *}
-            </ul>
+                    <div id="glm-member-list-terms">{$terms.term_member_plur_cap} found: {$membersFound}<br></div>
 
-        {/if} {* haveFeaturedMembers *}
+                    {apply_filters('glm-member-db-front-members-list-listHeaderBottom', '')}
 
-        {if $showSettings.list_show_list && !$blankStart}
-            {if $settings.list_header_text}
-            <h3 class="glm-member-db-list-header-title">{$settings.list_header_text}</h3>
-            {elseif apply_filters('is_page', 'search')}
-            <h1 class="glm-member-db-list-header-title member-search-page-title">List of {$terms.term_member_plur_cap}</h1>
-            {else}
-            <h3 class="glm-member-db-list-header-title">List of {$terms.term_member_plur_cap}</h3>
-            {/if}
-            {if $haveMembers}
+                    <!-- Member information displayed in list -->
 
-                <div id="glm-member-list-terms">{$terms.term_member_plur_cap} found: {$membersFound}<br></div>
-
-                {apply_filters('glm-member-db-front-members-list-listHeaderBottom', '')}
-
-                <!-- Member information displayed in list -->
-
-
-                {* Alpha List *}
-
-                {if $showSettings.list_show_search_alpha && !apply_filters("is_page", 'search')}
-                    <div class="glm-alpha-links">
-                        <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}{if isset($smarty.request.s) && $smarty.request.s}&s={$smarty.request.s|escape}{/if}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}#glm-member-list-filters-button" class="glm-alpha-link{if !$alphaSelected} glm-alpha-link-selected{/if}">All</a>
-                        {foreach $alphaList as $a}
-                            <a href="{$thisUrl}?glm_action=list&alpha={$a.alpha}&textSearch={$textSearch}{if isset($smarty.request.s) && $smarty.request.s}&s={$smarty.request.s|escape}{/if}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}#glm-member-list-filters-button" class="glm-alpha-link{if $a.default} glm-alpha-link-selected{/if}">{$a.alpha}</a>
-                        {/foreach}
-                    </div>
-                {/if}
 
-                {* Page selection top *}
+                    {* Alpha List *}
 
-                {if $paging}
-                    {if ( $prevStart || $nextStart ) && !$settings.list_ajax_pagination}
-                        <br>
-                        <div class="paging-container">
-                            <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}{if isset($smarty.request.s)}&s={$smarty.request.s|escape}{/if}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&citySearch={$citySearchSelected}&pageSelect=Previous&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}#glm-member-list-filters-button" class="glm-alpha-link" {if !$prevStart} style="pointer-events: none; opacity: 0.5;"{/if}>< Previous page</a>
-                            <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}{if isset($smarty.request.s)}&s={$smarty.request.s|escape}{/if}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&citySearch={$citySearchSelected}&pageSelect=Next&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}#glm-member-list-filters-button" class="glm-alpha-link" {if !$nextStart} style="pointer-events: none; opacity: 0.5;"{/if}>Next page ></a>
+                    {if $showSettings.list_show_search_alpha && !apply_filters("is_page", 'search')}
+                        <div class="glm-alpha-links">
+                            <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}{if isset($smarty.request.s) && $smarty.request.s}&s={$smarty.request.s|escape}{/if}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}#glm-member-list-filters-button" class="glm-alpha-link{if !$alphaSelected} glm-alpha-link-selected{/if}">All</a>
+                            {foreach $alphaList as $a}
+                                <a href="{$thisUrl}?glm_action=list&alpha={$a.alpha}&textSearch={$textSearch}{if isset($smarty.request.s) && $smarty.request.s}&s={$smarty.request.s|escape}{/if}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}#glm-member-list-filters-button" class="glm-alpha-link{if $a.default} glm-alpha-link-selected{/if}">{$a.alpha}</a>
+                            {/foreach}
                         </div>
-                        <br>
-                    {/if}
-                    <br>
-                    <div class="glm-members-found">
-                        showing <span class="aStart">{$start}</span> through <span class="aLastDisplayed">{$lastDisplayed}</span> of <span class="aTotal">{$filteredMembersFound}</span>
-                    </div>
-                {/if}
-
-                {* Members List *}
-
-                {if $settings.list_ajax_pagination}
-                    <div id="glm-ajax-list">
-                        loading...
-                    </div>
-                {else}
-                    {if $view == list}
-                        {include file='front/members/listTypeList.html'}
-                    {/if}
-                    {if $view == grid}
-                        {include file='front/members/listTypeGrid.html'}
                     {/if}
-                {/if}
 
-                {* Page selection bottom *}
+                    {* Page selection top *}
 
-                <div class="paging-container">
                     {if $paging}
                         {if ( $prevStart || $nextStart ) && !$settings.list_ajax_pagination}
                             <br>
                             </div>
                             <br>
                         {/if}
-                        {if $nextStart && $settings.list_ajax_pagination}
-                            <a href="#" class="glm-show-more test" data-next="{$nextStart}">[ Load More ]</a>
-                        {/if}
                         <br>
                         <div class="glm-members-found">
                             showing <span class="aStart">{$start}</span> through <span class="aLastDisplayed">{$lastDisplayed}</span> of <span class="aTotal">{$filteredMembersFound}</span>
                         </div>
                     {/if}
-                </div>
-                {apply_filters('glm-member-db-front-members-list-pageBottom', '')}
-
-            {else}
-                <div>(no {$terms.term_member_plur} listed)</div>
-            {/if}
-
-        {/if} {* list_show_list *}
-
-{if $showSettings.list_map_show_container}
-    </div> {* glm-member-list-inner-wrapper *}
-{/if}
-{if $showSettings.list_show_outer_container}
-    </div> {* glm-member-db-list *}
-{/if}
-
-<script type="text/javascript">
-
-    jQuery(document).ready(function($) {
-
-        {if $settings.list_ajax_pagination}
-            var nextStart    = {if $nextStart}{$nextStart}{else}0{/if};
-            var numberShown  = 0;
-            var totalMembers = {$filteredMembersFound};
-
-            jQuery.ajax({
-                url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=membersList&limit={$settings.list_pagination_count}{$ajaxRequest}&alpha={$alphaSelected}',
-                cache: false,
-                async: true,
-                dataType: 'html',
-                success: function( html ){
-                    $('#glm-ajax-list').html( html );
-                    numberShown += {$settings.list_pagination_count};
-                },
-            });
-
-            // Show More link
-            $(document).on('click', 'a.glm-show-more', function(e){
-                e.preventDefault();
-                // var nextStart = $(this).data('next');
-                var showMoreButton = $(this);
+
+                    {* Members List *}
+
+                    {if $settings.list_ajax_pagination}
+                        <div id="glm-ajax-list">
+                            loading...
+                        </div>
+                    {else}
+                        {if $view == list}
+                            {include file='front/members/listTypeList.html'}
+                        {/if}
+                        {if $view == grid}
+                            {include file='front/members/listTypeGrid.html'}
+                        {/if}
+                    {/if}
+
+                    {* Page selection bottom *}
+
+                    <div class="paging-container">
+                        {if $paging}
+                            {if ( $prevStart || $nextStart ) && !$settings.list_ajax_pagination}
+                                <br>
+                                <div class="paging-container">
+                                    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}{if isset($smarty.request.s)}&s={$smarty.request.s|escape}{/if}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&citySearch={$citySearchSelected}&pageSelect=Previous&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}#glm-member-list-filters-button" class="glm-alpha-link" {if !$prevStart} style="pointer-events: none; opacity: 0.5;"{/if}>< Previous page</a>
+                                    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}{if isset($smarty.request.s)}&s={$smarty.request.s|escape}{/if}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&citySearch={$citySearchSelected}&pageSelect=Next&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}#glm-member-list-filters-button" class="glm-alpha-link" {if !$nextStart} style="pointer-events: none; opacity: 0.5;"{/if}>Next page ></a>
+                                </div>
+                                <br>
+                            {/if}
+                            {if $nextStart && $settings.list_ajax_pagination}
+                                <a href="#" class="glm-show-more test" data-next="{$nextStart}">[ Load More ]</a>
+                            {/if}
+                            <br>
+                            <div class="glm-members-found">
+                                showing <span class="aStart">{$start}</span> through <span class="aLastDisplayed">{$lastDisplayed}</span> of <span class="aTotal">{$filteredMembersFound}</span>
+                            </div>
+                        {/if}
+                    </div>
+                    {apply_filters('glm-member-db-front-members-list-pageBottom', '')}
+
+                {else}
+                    <div>(no {$terms.term_member_plur} listed)</div>
+                {/if}
+
+            {/if} {* list_show_list *}
+
+    {if $showSettings.list_map_show_container}
+        </div> {* glm-member-list-inner-wrapper *}
+    {/if}
+    {if $showSettings.list_show_outer_container}
+        </div> {* glm-member-db-list *}
+    {/if}
+
+    <script type="text/javascript">
+
+        jQuery(document).ready(function($) {
+
+            {if $settings.list_ajax_pagination}
+                var nextStart    = {if $nextStart}{$nextStart}{else}0{/if};
+                var numberShown  = 0;
+                var totalMembers = {$filteredMembersFound};
+
                 jQuery.ajax({
-                    url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=membersList&limit={$settings.list_pagination_count}{$ajaxRequest}&pageSelect=Next&nextStart=' + nextStart + '&ajaxNext=1&alpha={$alphaSelected}',
+                    url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=membersList&limit={$settings.list_pagination_count}{$ajaxRequest}&alpha={$alphaSelected}',
                     cache: false,
                     async: true,
                     dataType: 'html',
                     success: function( html ){
-                        $('#glm-ajax-list').append( html );
-                        // $('.aStart').html(nextStart + 1);
-                        nextStart += {$settings.list_pagination_count};
-                        if ( nextStart > totalMembers ) {
-                            nextStart = totalMembers;
-                            $('.aLastDisplayed').html(nextStart);
-                        } else {
-                            $('.aLastDisplayed').html(nextStart - 1);
-                        }
+                        $('#glm-ajax-list').html( html );
                         numberShown += {$settings.list_pagination_count};
-                        console.log('shown: ', numberShown);
-                        console.log( 'nextStart', nextStart);
-                        console.log( 'totalMembers', totalMembers);
-                        if ( numberShown >= totalMembers ) {
-                            showMoreButton.remove();
-                        }
                     },
                 });
-            });
-        {/if} {* list_ajax_pagination *}
 
-        jQuery('select[multiple]').asmSelect();
+                // Show More link
+                $(document).on('click', 'a.glm-show-more', function(e){
+                    e.preventDefault();
+                    // var nextStart = $(this).data('next');
+                    var showMoreButton = $(this);
+                    jQuery.ajax({
+                        url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=membersList&limit={$settings.list_pagination_count}{$ajaxRequest}&pageSelect=Next&nextStart=' + nextStart + '&ajaxNext=1&alpha={$alphaSelected}',
+                        cache: false,
+                        async: true,
+                        dataType: 'html',
+                        success: function( html ){
+                            $('#glm-ajax-list').append( html );
+                            // $('.aStart').html(nextStart + 1);
+                            nextStart += {$settings.list_pagination_count};
+                            if ( nextStart > totalMembers ) {
+                                nextStart = totalMembers;
+                                $('.aLastDisplayed').html(nextStart);
+                            } else {
+                                $('.aLastDisplayed').html(nextStart - 1);
+                            }
+                            numberShown += {$settings.list_pagination_count};
+                            console.log('shown: ', numberShown);
+                            console.log( 'nextStart', nextStart);
+                            console.log( 'totalMembers', totalMembers);
+                            if ( numberShown >= totalMembers ) {
+                                showMoreButton.remove();
+                            }
+                        },
+                    });
+                });
+            {/if} {* list_ajax_pagination *}
 
-        // Show search filters box
-        {if $showSettings.list_show_search && $showSettings.list_search_show_button}
+            jQuery('select[multiple]').asmSelect();
 
-            // Float filter box
-            var fixmeTop = $('#glm-member-list-filters-button').offset().top;
-            $(window).scroll(function() {
+            // Show search filters box
+            {if $showSettings.list_show_search && $showSettings.list_search_show_button}
 
-                var currentScroll = $(window).scrollTop();
-                if (currentScroll >= fixmeTop-{$settings.list_floating_search_distance_top} && {$settings.list_floating_search}) {
-                    $('#glm-member-list-filters-wrapper').css({
-                        position: 'fixed',
-                        top: '{$settings.list_floating_search_distance_top}px',
-                        transform: 'translateX(0%)'
-                    });
-                } else {
-                    $('#glm-member-list-filters-wrapper').css({
-                        position: 'relative',
-                        top: '0',
-                        transform: 'translateX(0%)'
-                    });
-                }
-
-            });
-            $(".glm-member-list-filters-toggle").click( function() {
-                $(".glm-member-db-{$view}-view").toggleClass("filters-opened");
-                $(".glm-member-db-{$view}-view").toggleClass("filters-closed");
-/* NEED TO FIX THIS FOR LEAFLET
-                $("#glm-locationMap-container").one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",
-                    function() {
-                        var center = map.getCenter();
-                        google.maps.event.trigger(map, "resize");
-                        map.setCenter(center);
-                    });
-*/
-                });
-        {/if} // settings.list_show_search
+                // Float filter box
+                var fixmeTop = $('#glm-member-list-filters-button').offset().top;
+                $(window).scroll(function() {
 
-        {if $showSettings.list_show_map}
+                    var currentScroll = $(window).scrollTop();
+                    if (currentScroll >= fixmeTop-{$settings.list_floating_search_distance_top} && {$settings.list_floating_search}) {
+                        $('#glm-member-list-filters-wrapper').css({
+                            position: 'fixed',
+                            top: '{$settings.list_floating_search_distance_top}px',
+                            transform: 'translateX(0%)'
+                        });
+                    } else {
+                        $('#glm-member-list-filters-wrapper').css({
+                            position: 'relative',
+                            top: '0',
+                            transform: 'translateX(0%)'
+                        });
+                    }
 
-            /*
-             * Map operations
-             */
+                });
+                $(".glm-member-list-filters-toggle").click( function() {
+                    $(".glm-member-db-{$view}-view").toggleClass("filters-opened");
+                    $(".glm-member-db-{$view}-view").toggleClass("filters-closed");
+    /* NEED TO FIX THIS FOR LEAFLET
+                    $("#glm-locationMap-container").one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",
+                        function() {
+                            var center = map.getCenter();
+                            google.maps.event.trigger(map, "resize");
+                            map.setCenter(center);
+                        });
+    */
+                    });
+            {/if} // settings.list_show_search
 
-            var startLat = $('#glmLat').val();
-            var startLon = $('#glmLng').val();
-            var defZoom = Number({$settings.maps_default_zoom});
+            {if $showSettings.list_show_map}
 
-            {if $settings.selected_map_interface == 1}
+                /*
+                 * Map operations
+                 */
 
-                {*
-                 *  Leaflet Map
-                 *  API reference: https://leafletjs.com/reference-1.3.2.html
-                 *}
+                var startLat = $('#glmLat').val();
+                var startLon = $('#glmLng').val();
+                var defZoom = Number({$settings.maps_default_zoom});
 
-                function initMap() {
+                {if $settings.selected_map_interface == 1}
 
-                    var leafletMap = L.map('LeafletMapContainer', {
-                        gestureHandling: true
-                    });
-                    leafletMap.setView([{$settings.maps_default_lat}, {$settings.maps_default_lon}], defZoom);
-                    var leafletTileServer = '{$settings.leaflet_tile_server}/{$settings.leaflet_tile_server_key}/' + {literal}'{z}/{x}/{y}.png'{/literal};
-                    var leafletMinZoom = 3;
-                    var leafletMaxZoom = 19;
-                    var clusterRadiusMax = 40;
-                    var geocoder;
-
-                    // Loading features
-                    var loadingControl = L.Control.loading({
-                        separate: true,
-                        delayIndicator: 500
-                    });
-                    leafletMap.addControl(loadingControl);
+                    {*
+                     *  Leaflet Map
+                     *  API reference: https://leafletjs.com/reference-1.3.2.html
+                     *}
 
-                    // Init Map
-                    L.tileLayer(leafletTileServer, {
-                       attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery Â© <a href="https://www.gaslightmedia.com/">Gaslight Media</a>',
-                       minZoom: leafletMinZoom,
-                       maxZoom: leafletMaxZoom,
-                       id: 'nothot'
-                    }).addTo(leafletMap);
+                    function initMap() {
 
+                        var leafletMap = L.map('LeafletMapContainer', {
+                            gestureHandling: true
+                        });
+                        leafletMap.setView([{$settings.maps_default_lat}, {$settings.maps_default_lon}], defZoom);
+                        var leafletTileServer = '{$settings.leaflet_tile_server}/{$settings.leaflet_tile_server_key}/' + {literal}'{z}/{x}/{y}.png'{/literal};
+                        var leafletMinZoom = 3;
+                        var leafletMaxZoom = 19;
+                        var clusterRadiusMax = 40;
+                        var geocoder;
+
+                        // Loading features
+                        var loadingControl = L.Control.loading({
+                            separate: true,
+                            delayIndicator: 500
+                        });
+                        leafletMap.addControl(loadingControl);
 
-                    {if $mapItems}
+                        // Init Map
+                        L.tileLayer(leafletTileServer, {
+                           attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery Â© <a href="https://www.gaslightmedia.com/">Gaslight Media</a>',
+                           minZoom: leafletMinZoom,
+                           maxZoom: leafletMaxZoom,
+                           id: 'nothot'
+                        }).addTo(leafletMap);
 
-                        {if $settings.use_cluster_markers}
-                            var markerGroup = L.markerClusterGroup({
-                                maxClusterRadius: clusterRadiusMax
-                            });
-                        {else}
-                            var markerGroup = L.featureGroup({
-                                maxClusterRadius: clusterRadiusMax
-                            });
-                        {/if}
 
-                        var mapContainerWidth = Number(leafletMap._container.clientWidth);
-                        var maxPopupWidth = .65 * mapContainerWidth;
-                        if (maxPopupWidth > 600) {
-                            maxPopupWidth = 600;
-                        }
-                        var mapContainerHeight = Number(leafletMap._container.clientHeight);
-                        var maxPopupHeight = .7 * mapContainerHeight;
-
-                        {foreach $mapItems as $m}
-                            {if $m.lat != 0 && $m.lon != 0}
-                                // Create marker for this member and and to Feature Group
-                                var leafletMarker = L.marker([{$m.lat}, {$m.lon}], { title:  '{$m.member_name|escape:quotes}' })
-                                    .bindPopup($('#map_info_' + {$m.id}).html(), {
-                                        maxWidth: maxPopupWidth,
-                                        maxHeight: maxPopupHeight
-                                }).addTo(markerGroup);
-                            {/if}
-                        {/foreach}
+                        {if $mapItems}
 
-                        leafletMap.addLayer(markerGroup);
+                            {if $settings.use_cluster_markers}
+                                var markerGroup = L.markerClusterGroup({
+                                    maxClusterRadius: clusterRadiusMax
+                                });
+                            {else}
+                                var markerGroup = L.featureGroup({
+                                    maxClusterRadius: clusterRadiusMax
+                                });
+                            {/if}
 
-                        // Get outer bounds of all markers in the Feature Group
-                        leafletMap.fitBounds(markerGroup.getBounds());
+                            var mapContainerWidth = Number(leafletMap._container.clientWidth);
+                            var maxPopupWidth = .65 * mapContainerWidth;
+                            if (maxPopupWidth > 600) {
+                                maxPopupWidth = 600;
+                            }
+                            var mapContainerHeight = Number(leafletMap._container.clientHeight);
+                            var maxPopupHeight = .7 * mapContainerHeight;
+
+                            {foreach $mapItems as $m}
+                                {if $m.lat != 0 && $m.lon != 0}
+                                    // Create marker for this member and and to Feature Group
+                                    var leafletMarker = L.marker([{$m.lat}, {$m.lon}], { title:  '{$m.member_name|escape:quotes}' })
+                                        .bindPopup($('#map_info_' + {$m.id}).html(), {
+                                            maxWidth: maxPopupWidth,
+                                            maxHeight: maxPopupHeight
+                                    }).addTo(markerGroup);
+                                {/if}
+                            {/foreach}
 
-                    {/if} {* mapItems *}
+                            leafletMap.addLayer(markerGroup);
 
-                    // When a marker is clicked, display the pop-up near the center of the map.
+                            // Get outer bounds of all markers in the Feature Group
+                            leafletMap.fitBounds(markerGroup.getBounds());
 
-                    leafletMap.on('popupopen', function(e) {
-                        var px = leafletMap.project(e.popup._latlng);
-                        px.x -= 20;                                         // Bump a bit to the right to avoid resize buttons
-                        px.y -= e.popup._container.clientHeight/2;          // Position more toward the center
-                        leafletMap.panTo(leafletMap.unproject(px),{ animate: true });
-                    });
+                        {/if} {* mapItems *}
 
-                }
+                        // When a marker is clicked, display the pop-up near the center of the map.
 
-            {/if} {* Map interface 1 *}
+                        leafletMap.on('popupopen', function(e) {
+                            var px = leafletMap.project(e.popup._latlng);
+                            px.x -= 20;                                         // Bump a bit to the right to avoid resize buttons
+                            px.y -= e.popup._container.clientHeight/2;          // Position more toward the center
+                            leafletMap.panTo(leafletMap.unproject(px),{ animate: true });
+                        });
 
-            {if $settings.selected_map_interface == 2}
+                    }
 
-                {*
-                 * Google Maps
-                 *  API reference: https://developers.google.com/maps/documentation/javascript/reference
-                 *}
+                {/if} {* Map interface 1 *}
 
-                function initMap() {
+                {if $settings.selected_map_interface == 2}
 
-                    // Create a Google Map object
-                    var map = new google.maps.Map(document.getElementById('glm-locationMap'), {
-                            center: new google.maps.LatLng({$settings.maps_default_lat}, {$settings.maps_default_lon}),
-                            zoom: {$settings.maps_default_zoom},
-                        disableDefaultUI: false,
-                        mapTypeId: google.maps.MapTypeId.MAP,
-                    });
+                    {*
+                     * Google Maps
+                     *  API reference: https://developers.google.com/maps/documentation/javascript/reference
+                     *}
 
-                    var center = map.getCenter();
-                    google.maps.event.trigger(map, "resize");
-                    map.setCenter(center);
-
-                    var currentScroll = $(window).scrollTop(); // get current position
-                    var mapTop = $("#glm-locationMap-container").offset().top-10;
-                    {if $showSettings.list_show_search}fixmeTop = $('#glm-member-list-filters-button').offset().top;{/if}
-                    if (currentScroll >= mapTop) {
-                        $('body,html').animate({
-                        scrollTop: $("#glm-locationMap-container").offset().top-100
-                        }, 50);
-                    } else {
-                        $('body,html').animate({
-                            scrollTop: $("#glm-locationMap-container").offset().top-100
-                        }, 400);
-                    }
+                    function initMap() {
 
-                    var geocoder = new google.maps.Geocoder();
-                    var bounds = new google.maps.LatLngBounds();
-                    var infowindow = new google.maps.InfoWindow();
-
-                    {if $mapItems}
-                        var markers = [];
-                        {foreach $mapItems as $m}
-                            {if $m.lat != 0 && $m.lon != 0}
-
-                                // Create a marker for this member
-                                var marker = new google.maps.Marker({
-                                    map: map,
-                                    position: new google.maps.LatLng({$m.lat}, {$m.lon}),
-                                    draggable: false,
-                                    animation: google.maps.Animation.DROP,
-                                    title: '{$m.member_name|escape:quotes}',
-                                    descr: $('#map_info_' + {$m.id}).html(),
-                                    memberID: {$m.member}
-                                });
+                        // Create a Google Map object
+                        var map = new google.maps.Map(document.getElementById('glm-locationMap'), {
+                                center: new google.maps.LatLng({$settings.maps_default_lat}, {$settings.maps_default_lon}),
+                                zoom: {$settings.maps_default_zoom},
+                            disableDefaultUI: false,
+                            mapTypeId: google.maps.MapTypeId.MAP,
+                        });
 
-                                // Add a click listener for this marker
-                                marker.addListener('click', function() {
-                                        infowindow.setOptions({
-                                                content: this.descr
-                                        });
-                                    infowindow.open(map,this);
-                                });
+                        var center = map.getCenter();
+                        google.maps.event.trigger(map, "resize");
+                        map.setCenter(center);
 
-                                markers.push(marker);
+                        var currentScroll = $(window).scrollTop(); // get current position
+                        var mapTop = $("#glm-locationMap-container").offset().top-10;
+                        {if $showSettings.list_show_search}fixmeTop = $('#glm-member-list-filters-button').offset().top;{/if}
+                        if (currentScroll >= mapTop) {
+                            $('body,html').animate({
+                            scrollTop: $("#glm-locationMap-container").offset().top-100
+                            }, 50);
+                        } else {
+                            $('body,html').animate({
+                                scrollTop: $("#glm-locationMap-container").offset().top-100
+                            }, 400);
+                        }
 
-                                // Extend the map bounds to include this marker
-                                bounds.extend(marker.position);
+                        var geocoder = new google.maps.Geocoder();
+                        var bounds = new google.maps.LatLngBounds();
+                        var infowindow = new google.maps.InfoWindow();
+
+                        {if $mapItems}
+                            var markers = [];
+                            {foreach $mapItems as $m}
+                                {if $m.lat != 0 && $m.lon != 0}
+
+                                    // Create a marker for this member
+                                    var marker = new google.maps.Marker({
+                                        map: map,
+                                        position: new google.maps.LatLng({$m.lat}, {$m.lon}),
+                                        draggable: false,
+                                        animation: google.maps.Animation.DROP,
+                                        title: '{$m.member_name|escape:quotes}',
+                                        descr: $('#map_info_' + {$m.id}).html(),
+                                        memberID: {$m.member}
+                                    });
+
+                                    // Add a click listener for this marker
+                                    marker.addListener('click', function() {
+                                            infowindow.setOptions({
+                                                    content: this.descr
+                                            });
+                                        infowindow.open(map,this);
+                                    });
+
+                                    markers.push(marker);
+
+                                    // Extend the map bounds to include this marker
+                                    bounds.extend(marker.position);
 
+                                {/if}
+                            {/foreach}
+
+                            {if $settings.use_cluster_markers}
+                                var markerCluster = new MarkerClusterer(map, markers,
+                                {
+                                    imagePath: '{$baseUrl}/js/googleMapsMarkerClusterer/images/m',
+                                    gridSize: 30,
+                                    maxZoom: 14,
+                                    minimunClusterSize: 3
+                                });
                             {/if}
-                        {/foreach}
-
-                        {if $settings.use_cluster_markers}
-                            var markerCluster = new MarkerClusterer(map, markers,
-                            {
-                                imagePath: '{$baseUrl}/js/googleMapsMarkerClusterer/images/m',
-                                gridSize: 30,
-                                maxZoom: 14,
-                                minimunClusterSize: 3
-                            });
-                        {/if}
 
-                        // Fit map to bounds of all markers
-                        map.fitBounds(bounds);
+                            // Fit map to bounds of all markers
+                            map.fitBounds(bounds);
 
-                        // Check for first map idle (completely loaded) - Check max zoom
-                        var mapLoadedListener = google.maps.event.addListener(map, 'idle', function() {
-                            if (map.getZoom() > 14) {
-                                this.setZoom(14);
-                            }
-                            google.maps.event.removeListener(mapLoadedListener);
-                        });
+                            // Check for first map idle (completely loaded) - Check max zoom
+                            var mapLoadedListener = google.maps.event.addListener(map, 'idle', function() {
+                                if (map.getZoom() > 14) {
+                                    this.setZoom(14);
+                                }
+                                google.maps.event.removeListener(mapLoadedListener);
+                            });
 
-                    {/if} {* mapItems *}
+                        {/if} {* mapItems *}
 
-                } {* initMap *}
+                    } {* initMap *}
 
-            {/if} {* Map interface 2 *}
+                {/if} {* Map interface 2 *}
 
-            // Handle Map View/Hide
-            var mapInitialized = false;
-            $("#glm-member-list-map-toggle").click( function() {
-                $(".glm-member-db-{$view}-view").toggleClass("map-opened");
-                $(".glm-member-db-{$view}-view").toggleClass("map-closed");
-                if (!mapInitialized) {
-                    initMap();
-                    mapInitialized = true;
-                }
-            });
-            {if $showSettings.list_show_map}
-                {if $showSettings.list_map_show_opened || $view == 'map'}
-                    // Start with map opened
-                    initMap();
-                    mapInitialized = true;
+                // Handle Map View/Hide
+                var mapInitialized = false;
+                $("#glm-member-list-map-toggle").click( function() {
+                    $(".glm-member-db-{$view}-view").toggleClass("map-opened");
+                    $(".glm-member-db-{$view}-view").toggleClass("map-closed");
+                    if (!mapInitialized) {
+                        initMap();
+                        mapInitialized = true;
+                    }
+                });
+                {if $showSettings.list_show_map}
+                    {if $showSettings.list_map_show_opened || $view == 'map'}
+                        // Start with map opened
+                        initMap();
+                        mapInitialized = true;
+                    {/if}
                 {/if}
-            {/if}
 
-            // Processes click-through counts for website links
-            $('.glm-member-list-website-link').on('click', function() {
+                // Processes click-through counts for website links
+                $('.glm-member-list-website-link').on('click', function() {
+
+                    // Get member ID
+                    var memberId = $(this).attr('data-member-id');
+                    var memberSlug = $(this).attr('data-member-slug');
 
-                // Get member ID
-                var memberId = $(this).attr('data-member-id');
-                var memberSlug = $(this).attr('data-member-slug');
+                    // Send AJAX action to record click.
+                    $.ajax({
+                       url: "{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=memberClickThrough&memberId=" + memberId + "&memberSlug=" + memberSlug
+                    });
 
-                // Send AJAX action to record click.
-                $.ajax({
-                   url: "{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=memberClickThrough&memberId=" + memberId + "&memberSlug=" + memberSlug
                 });
 
-            });
+            {/if}   // settings.list_show_map
 
-        {/if}   // settings.list_show_map
+        });
+    </script>
 
-    });
-</script>
+    {if $showSettings.list_show_outer_container}
+        {include file='front/footer.html'}
+    {/if}
 
-{if $showSettings.list_show_outer_container}
-    {include file='front/footer.html'}
-{/if}
+{/if} {* have messages *}
\ No newline at end of file
index 867d0c6..c1a475c 100644 (file)
 
                     </div>
                     <div class="glm-member-list-items">
-                        {if $member.categories && $showSettings.list_show_categories}
+                        {if isset($member.categories) && $member.categories && $showSettings.list_show_categories}
                             <b>{$terms.term_member_cap} Categories</b>
                             <ul>
                                 {foreach $member.categories as $c}
                                 {/foreach}
                             </ul>
                         {/if}
-                        {if $member.amenities && $showSettings.list_show_amenities}
+                        {if isset($member.categories) && $member.amenities && $showSettings.list_show_amenities}
                             <b>{$terms.term_member_cap} Amenities</b>
                             <ul>
                                 {foreach $member.amenities as $A}