Updating member list and export query.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 11 Aug 2017 18:40:56 +0000 (14:40 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 11 Aug 2017 18:40:56 +0000 (14:40 -0400)
This is to correct the category sub query to include the status of the
member info record.

models/admin/ajax/membersListExport.php
models/admin/members/list.php

index 8ffab3a..012f039 100644 (file)
@@ -126,17 +126,16 @@ class GlmMembersAdmin_ajax_membersListExport extends GlmDataMemberInfo
         );
 
         // Only return information records that are active
-        $where .= " AND status = ".$this->config['status_numb']['Active'];
 
         // Check if this is a request to show archived members
         if (isset($_REQUEST['filterArchived'])) {
-            $where .= " AND access = ".$this->config['access_numb']['Archived'];
+            $where .= " AND T.status = ".$this->config['access_numb']['Archived'];
             $filterArchived = true;
             $haveFilter = true;
 
         // If not, don't show them
         } else {
-//            $where .= " AND access != ".$this->config['access_numb']['Archived'];
+            $where .= " AND T.status = ".$this->config['status_numb']['Active'];
         }
 
             // Check for a text search
@@ -164,11 +163,12 @@ class GlmMembersAdmin_ajax_membersListExport extends GlmDataMemberInfo
             }
 
             $where .= " AND T.id in (
-                SELECT DISTINCT(I.member)
+                SELECT DISTINCT(I.id)
                   FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info I,
                        ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info M,
                        ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories C
                  WHERE I.id = M.member_info
+                   AND I.status = " . ( isset( $_REQUEST['filterArchived'] ) ?  $this->config['status_numb']['Archived']: $this->config['status_numb']['Active'] )."
                    AND (
                        M.category in ($cats)
                        OR (C.parent in ($cats) AND M.category = C.id)
@@ -217,6 +217,7 @@ class GlmMembersAdmin_ajax_membersListExport extends GlmDataMemberInfo
         $category_data = $this->wpdb->get_results( $sql, ARRAY_A );
         //echo '<pre>$category_data: ' . print_r( $category_data, true ) . '</pre>';
 
+        //echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
         // Get a current list of members without paging
         $list = $this->getList($where, "member_name");
         //echo '<pre>$list: ' . print_r( $list, true ) . '</pre>';
index d7c04db..32c00aa 100644 (file)
@@ -185,6 +185,7 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
                            ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info M,
                            ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories C
                      WHERE I.id = M.member_info
+                       AND I.status != " . $this->config['status_numb']['Archived'] ."
                        AND (
                            M.category in ($cats)
                            OR (C.parent in ($cats) AND M.category = C.id)