From e9799051cb28c9e5892ad0ea94f9b7009f81146f Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Wed, 18 Jan 2017 09:14:44 -0500 Subject: [PATCH] Fixing query for counties and ordering by alpha The array for counties was retaining empty values and using them as options on the contact list county dropdown. The query for counties has been changed to order the result alphabetically. --- models/front/contacts/list.php | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/models/front/contacts/list.php b/models/front/contacts/list.php index 0d563e0..063a42d 100644 --- a/models/front/contacts/list.php +++ b/models/front/contacts/list.php @@ -108,22 +108,17 @@ class GlmMembersFront_contacts_list extends GlmDataContacts $memberData = false; $memberName = false; $membersList = false; - $contactsList = false; - $haveContacts = false; $contactID = false; $contactInfo = false; $filterArchived = false; $filterText = false; $countySearch = false; - $countyList = array(); $haveCounties = false; $haveFilter = false; $contactMembers = array(); - $order = false; $textSearch = ''; $blankStart = false; - $membersFound = false; // Paging Parameters $paging = true; @@ -133,18 +128,8 @@ class GlmMembersFront_contacts_list extends GlmDataContacts $nextStart = false; $start = 1; $limit = 20; // Set to the number of listings per page - $namesList = false; $where = ''; - - $validOptions = array( - 'create', - 'addNew', - 'edit', - 'submit', - 'delete', - 'list' - ); if (isset($_REQUEST['textSearch'])) { @@ -193,9 +178,6 @@ class GlmMembersFront_contacts_list extends GlmDataContacts $memberName = $memberData['name']; } - // Make sure option is set to list - $option = 'list'; - $where = ' TRUE '; // Only list member contacts for the selected member @@ -240,8 +222,6 @@ class GlmMembersFront_contacts_list extends GlmDataContacts // Get full list of names matching this where clause for search box $namesList = $this->getIdName($where); - - // If doing alpha list $alphaList = false; $alphaWhere = ''; @@ -352,8 +332,9 @@ class GlmMembersFront_contacts_list extends GlmDataContacts } // Get a list of counties - $countyList = $this->wpdb->get_col("SELECT DISTINCT county FROM ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts WHERE active = true ORDER BY county ASC;"); - if ($countyList[0]) { + $countyList = array_filter($this->wpdb->get_col("SELECT DISTINCT county FROM ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts WHERE active = true ORDER BY county ASC;")); + + if ($countyList) { $haveCounties = true; } -- 2.17.1