From: Chuck Scott Date: Wed, 21 Nov 2018 16:47:32 +0000 (-0500) Subject: Fixed problems with sort setting not being respected in member list after 1st page. X-Git-Tag: v2.11.0^2~55 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=0c640d2abc261dd3214d5a593d73ce50b5fb1a30;p=WP-Plugins%2Fglm-member-db.git Fixed problems with sort setting not being respected in member list after 1st page. Removed $memberSearch flag from all except where full text search Changed $memberSearch to $fullTextSearch Added pending changelog entry in readme.txt --- diff --git a/lib/GlmDataAbstract/DataAbstract.php b/lib/GlmDataAbstract/DataAbstract.php index 650c9a71..20861ff8 100755 --- a/lib/GlmDataAbstract/DataAbstract.php +++ b/lib/GlmDataAbstract/DataAbstract.php @@ -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 "

getList():
+ + + + + + + + + +
Where:$where
Order:$order
Field Vals:$fieldVals
ID Field:$idField
Start:$start
Limit:$limit
Prohibit List Options$prohibitListOptions
Append Select$appendSelect
+

+ "; + */ + $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 "

Parameters supplied to genPseudoRandIdArray():
+ + + + + + + +
Count of ids array:".count($ids)."
Start:$start
Length:$length
ID Field:$idName
Seed Session Name:$seedSessionName
Seed:$seed
+

+ "; + */ + $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:
".str_replace(', ', '
', $idString); + return array('idString' => $idString, 'idArray' => $ids); } diff --git a/models/front/members/list.php b/models/front/members/list.php index bcaaadfc..5d6a0d6c 100755 --- a/models/front/members/list.php +++ b/models/front/members/list.php @@ -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 '
$memberSearch: ' . print_r( $memberSearch, true ) . '
'; + // If there's a full text search, handle separately + if ( $fullTextSearch ) { + + // echo '
$fullTextSearch: ' . print_r( $fullTextSearch, true ) . '
'; 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']) { diff --git a/readme.txt b/readme.txt index 6f1bc5d9..b38dd1e3 100755 --- a/readme.txt +++ b/readme.txt @@ -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