Fixed problems with sort setting not being respected in member list after 1st page.
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 21 Nov 2018 16:47:32 +0000 (11:47 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 21 Nov 2018 16:47:32 +0000 (11:47 -0500)
Removed $memberSearch flag from all except where full text search
Changed $memberSearch to $fullTextSearch
Added pending changelog entry in readme.txt

lib/GlmDataAbstract/DataAbstract.php
models/front/members/list.php
readme.txt

index 650c9a7..20861ff 100755 (executable)
@@ -3232,6 +3232,23 @@ $forEdit = true;
     public function getList( $where = '', $order = '', $fieldVals = true, $idField = 'id', $start = false, $limit = false, $prohibitListOptions = false, $appendSelect = null )
     {
 
+        // For testing only
+        /*
+        echo "<p>getList():<br>
+            <table>
+                <tr><td>Where:</td><td>$where</td></tr>
+                <tr><td>Order:</td><td>$order</td></tr>
+                <tr><td>Field Vals:</td><td>$fieldVals</td></tr>
+                <tr><td>ID Field:</td><td>$idField</td></tr>
+                <tr><td>Start:</td><td>$start</td></tr>
+                <tr><td>Limit:</td><td>$limit</td></tr>
+                <tr><td>Prohibit List Options</td><td>$prohibitListOptions</td></tr>
+                <tr><td>Append Select</td><td>$appendSelect</td></tr>
+            </table>
+            </p>
+        ";
+        */
+
         $seed = false;
 
         // NOTE: $fieldVals not yet implemented
@@ -4028,6 +4045,21 @@ $forEdit = true;
     private function genPseudoRandIdArray ($ids, $start = false, $length = false, $idName = 'id', $seedSessionName = 'GLM_PR_SEED', $seed = false)
     {
 
+        // For testing only
+        /*
+        echo "<p>Parameters supplied to genPseudoRandIdArray():<br>
+            <table>
+                <tr><td>Count of ids array:</td><td>".count($ids)."</td></tr>
+                <tr><td>Start:</td><td>$start</td></tr>
+                <tr><td>Length:</td><td>$length</td></tr>
+                <tr><td>ID Field:</td><td>$idName</td></tr>
+                <tr><td>Seed Session Name:</td><td>$seedSessionName</td></tr>
+                <tr><td>Seed:</td><td>$seed</td></tr>
+            </table>
+            </p>
+        ";
+        */
+
         $transientSeed = false;     // Indicates if the function was passed a specific seed. These are not stored back into session
 
         // Change $ids array to simple array of ids
@@ -4106,6 +4138,9 @@ $forEdit = true;
             }
         }
 
+        // For testing only
+        // echo "idArray for pseudo-random sorting:<br>".str_replace(', ', '<br>', $idString);
+
         return array('idString' => $idString, 'idArray' => $ids);
 
     }
index bcaaadf..5d6a0d6 100755 (executable)
@@ -187,7 +187,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         $citySearchSelected   = false;
         $haveFeaturedMembers  = false;
         $featuredMembers      = false;
-        $memberSearch         = false;
+        $fullTextSearch       = false;
         $appendSelect         = '';
 
         // Paging Parameters
@@ -203,7 +203,6 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         if (isset($_REQUEST['categorySearchMultiple']) && is_array($_REQUEST['categorySearchMultiple'])) {
             $actionData['request']['category'] = implode(',', $_REQUEST['categorySearchMultiple']);
             $multiSelectCats = true;
-            $memberSearch = true;
         }
 
         // Check for URL parameter override of shortcode parameters
@@ -212,15 +211,12 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         }
         if (isset($_REQUEST['memberType'])) {
             $actionData['request']['type'] = $_REQUEST['memberType'];
-            $memberSearch = true;
         }
         if (isset($_REQUEST['categorySearch'])) {
             $actionData['request']['category-search'] = $_REQUEST['categorySearch'];
-            $memberSearch = true;
         }
         if (isset($_REQUEST['textSearch'])) {
             $actionData['request']['text-search'] = $_REQUEST['textSearch'];
-            $memberSearch = true;
         }
         if (isset($_REQUEST['alpha'])) {
             $actionData['request']['alpha'] = $_REQUEST['alpha'];
@@ -321,7 +317,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
             $appendSelect = " match(member_name) against('$textSearch') as rel_name ";
             $whereSep = ' AND ';
             $textSearch = stripslashes($textSearch);
-            $memberSearch = true;
+            $fullTextSearch = true;
         }
 
         // Get regions for possible use in search pick list for regions used in active member info records.
@@ -329,11 +325,6 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         $Regions = new GlmDataRegions($this->wpdb, $this->config);
         $regionData = $Regions->getListForSearch(true);
 
-        // Get counties for possible use in search pick list for counties used in active member info records.
-        require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCounties.php';
-        $Counties = new GlmDataCounties($this->wpdb, $this->config);
-        $countyData = $Counties->getListForSearch(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);
@@ -371,37 +362,6 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
 
         }
 
-        $counties = array();
-        // If we have a county set in shortcode or via URL.
-        if ($actionData['request']['county-search']) {
-
-            // Convert comma separated list to an array
-            $countiesRequested = explode( ',', $actionData['request']['county-search'] );
-
-            // Check for numeric ID's only
-            while ( list( $k, $v ) = each( $countiesRequested ) ) {
-                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 there's counties shortcode or url options to restrict this page to certain counties
-        if (count($counties) > 0) {
-
-            while ( list($k,$v) = each ($countyData) ) {
-                if (!in_array($v['id'], $counties)) {
-                    unset ($countyData[$k]);
-                }
-            }
-
-        }
-
         // If we have a city set in shortcode or via URL.
         $cities = array();
         if ( isset( $actionData['request']['city-search'] )
@@ -913,8 +873,10 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
             // Get stats for number of members found matching current selection criteria (includes alpha selection)
             $filteredMembersFound = $this->getStats(str_replace('T.', '', $where.$alphaWhere));
 
-            if ( $memberSearch ) {
-                // echo '<pre>$memberSearch: ' . print_r( $memberSearch, true ) . '</pre>';
+            // If there's a full text search, handle separately
+            if ( $fullTextSearch ) {
+
+                // echo '<pre>$fullTextSearch: ' . print_r( $fullTextSearch, true ) . '</pre>';
                 if ( $appendSelect ) {
                     $order = " rel_name DESC, member_name ASC ";
                 } else {
@@ -931,7 +893,10 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
                     '',                 // 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']) {
 
index 6f1bc5d..b38dd1e 100755 (executable)
@@ -66,6 +66,10 @@ There is of course much more to this.
 (none)
 
 == Changelog ==
+= (pending) =
+* Fixed member listings not using selected sort order setting past first page.
+* Smarty Templates updated to version 3.1.33 due to use of "each()" that is being depricated in PHP.
+
 = 2.10.43 =
 * Country is no longer required for Authorize.net Payment Gateway unless International payment