Check for member access
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 3 May 2018 20:15:46 +0000 (16:15 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 3 May 2018 20:15:46 +0000 (16:15 -0400)
access should be 40

models/admin/migcsa/index.php
views/admin/migcsa/index.html

index 36d86df..210c762 100644 (file)
@@ -140,6 +140,10 @@ class GlmMembersAdmin_migcsa_index
         }
 
         switch( $option ) {
+        case 'checkMembers':
+            $view     = 'memberTypes';
+            $response = $this->checkMembers();
+            break;
         case 'updateEmail':
             $view     = 'memberTypes';
             $response = $this->updateCustomFieldEmails();
@@ -199,6 +203,30 @@ class GlmMembersAdmin_migcsa_index
 
     }
 
+    public function checkMembers()
+    {
+        // Get a list of pending or active members
+        $accounts = $this->wpdb->get_results(
+            "SELECT id,ref_dest,renewal_date
+               FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX  . "accounts
+              WHERE renewal_date + INTERVAL 1 YEAR + INTERVAL 30 DAY >= '2018-05-03'",
+            ARRAY_A
+        );
+        foreach ( $accounts as $account ) {
+            // Check the member to see if he has correct
+            $access = $this->wpdb->get_var(
+                $this->wpdb->prepare(
+                    "SELECT access
+                       FROM " . GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts
+                      WHERE ref_dest = %d",
+                    $account['ref_dest']
+                )
+            );
+            echo '<pre>$access: ' . print_r( $access, true ) . '</pre>';
+        }
+        return 'test';//'<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
+    }
+
     public function updateCustomFieldEmails()
     {
 
index 80e664d..3d87311 100644 (file)
@@ -16,3 +16,5 @@
 <a href="{$thisUrl}?page={$thisPage}&option=archive">Archive Old Users</a>
 <br />
 <a href="{$thisUrl}?page={$thisPage}&option=updateEmail">Update Custom field email</a>
+<br />
+<a href="{$thisUrl}?page={$thisPage}&option=checkMembers">Check Member Accounts</a>