Bug update for member contact listings
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 28 Mar 2017 14:14:34 +0000 (10:14 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 28 Mar 2017 14:14:34 +0000 (10:14 -0400)
Was only showing the current members contacts when it should have been
listing out all member contacts on the front end.
Removing the sql part where it was adding to the where for only one
member.

index.php
models/front/contacts/list.php

index ff589b2..3d0e8fa 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Members Database Contacts
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Gaslight Media Members Database.
- * Version: 1.0.21
+ * Version: 1.0.22
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -19,7 +19,7 @@
  * @package glmMembersDatabaseContacts
  * @author Gaslight Media <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.21
+ * @version 1.0.22
  */
 
 /*
@@ -33,7 +33,7 @@
  *  version when there's a change in the database!! Use the
  *  version nunmber of that release for the DB version.
  */
-define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.0.21');
+define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.0.22');
 define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION', '0.0.3');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
index 063a42d..9ef2cd5 100644 (file)
@@ -116,7 +116,7 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
         $haveCounties  = false;
         $haveFilter     = false;
         $contactMembers = array();
-        
+
         $textSearch     = '';
         $blankStart     = false;
 
@@ -130,8 +130,8 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
         $limit = 20;        // Set to the number of listings per page
 
         $where = '';
-        
-        
+
+
         if (isset($_REQUEST['textSearch'])) {
             $actionData['request']['text-search'] = $_REQUEST['textSearch'];
         }
@@ -144,25 +144,25 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
         }
 
         // If this is a logged in member user, then show their contacts only
-        if (isset($this->config['loggedInUser']['contactUser'])) {
+        //if (isset($this->config['loggedInUser']['contactUser'])) {
 
             // if there's logged in contact user
-            $contactUser = $this->config['loggedInUser']['contactUser'];
-            if ($contactUser['ref_type'] = $this->config['ref_type_numb']['Member']
-                    && $contactUser['ref_dest'] ) {
+            //$contactUser = $this->config['loggedInUser']['contactUser'];
+            //if ($contactUser['ref_type'] = $this->config['ref_type_numb']['Member']
+                    //&& $contactUser['ref_dest'] ) {
 
-                $loggedInMember = true;
+                //$loggedInMember = true;
 
                 // Filter all contact searches to their member contacts
-                $where .= " AND ref_type = ".$this->config['ref_type_numb']['Member']."
-                        AND ref_dest = ".$contactUser['ref_dest'];
+                //$where .= " AND ref_type = ".$this->config['ref_type_numb']['Member']."
+                        //AND ref_dest = ".$contactUser['ref_dest'];
 
                 // Also set their member as the current one
-                $this->memberID = $contactUser['ref_dest'];
-            }
+                //$this->memberID = $contactUser['ref_dest'];
+            //}
+
+        //}
 
-        }
-       
         // Load members data class
         require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php';
         $this->Members = new GlmDataMembers($this->wpdb, $this->config);
@@ -179,12 +179,7 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
         }
 
         $where = ' TRUE ';
-        
-        // Only list member contacts for the selected member
-        if ($haveMember) {
-            $where .= " AND ref_type = ".$this->config['ref_type_numb']['Member'].' AND ref_dest = '.$this->memberID;
-        }
-        
+
         // Filter by selected county
         if (isset($_REQUEST['countySearch'])) {
             $countySearch = esc_sql($_REQUEST['countySearch']);
@@ -193,7 +188,7 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
             )";
             $haveFilter = true;
         }
-        
+
         // Filter by text string supplied
         if (isset($_REQUEST['filterText'])) {
             $filterText = esc_sql($_REQUEST['filterText']);
@@ -207,15 +202,15 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
             )";
             $haveFilter = true;
         }
-        
+
         // Get the total number of contacts listed
         $numbContacts = $this->getStats($where);
-        
+
         // If the number of events is less than a page, don't do paging
         if ($numbContacts <= $limit) {
             $paging = false;
         }
-        
+
         // Setting $paging to false until we figure it out for contacts
         //$paging = false;
 
@@ -238,11 +233,11 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
             // Get full list for all other filters, but not filtered by alpha (that would be silly)
             $alphaList = $this->getAlphaList(' AND '.$where, $alphaSelected);
 
-        }        
-        
+        }
+
         $order = "lname, fname";
         // Get list of contacts
-                
+
         // Check if we're doing paging
         if (isset($_REQUEST['pageSelect'])) {
 
@@ -289,9 +284,9 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
                 ${$resultParam} = $this->getList($where.$alphaWhere, 'lname', true, 'id', $start, $limit);
 
         }
-        
-        
-        
+
+
+
             if ($paging) {
                 //Get paging results
                $numbDisplayed = $listResult['returned'];
@@ -314,10 +309,10 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
                 // since we're doing paging, we have to break out just the contact data
                 $list = $listResult['list'];
                 unset($listResult);
-            
+
             }
-        
-        
+
+
         // If we have list entries - even if it's an empty list
         $success = true;
         $haveContacts = false;
@@ -337,7 +332,7 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
         if ($countyList) {
             $haveCounties = true;
         }
-        
+
         // Compile template data
         $templateData = array(
             'option' => $option,