Update member import part to set status.
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 28 Jun 2017 19:15:39 +0000 (15:15 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 28 Jun 2017 19:15:39 +0000 (15:15 -0400)
Status is now being setup for each member profile.

models/admin/import/index.php

index edbfe47..1c12f17 100644 (file)
@@ -1013,7 +1013,7 @@ class GlmMembersAdmin_import_index
                 )
             );
             if ( !$memberTypeId ) {
-                $this->wpdb->import(
+                $this->wpdb->insert(
                     GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_type',
                     array(
                         'name'  => 'Default',
@@ -1094,13 +1094,37 @@ class GlmMembersAdmin_import_index
                     $short_descr .= ' ...';
                 }
 
+                // Setup the Member Profile Status
+                // Initial status if not being set
+                $profileStatus = $this->config['status_numb']['Active'];
+
+                if ( isset( $data['status'] ) ) {
+                    switch ( strtolower( $data['status'] ) ) {
+                    case 'active':
+                        $profileStatus = $this->config['status_numb']['Active'];
+                        break;
+                    case 'pending review':
+                        $profileStatus = $this->config['status_numb']['Pending Review'];
+                        break;
+                    case 'inactive':
+                        $profileStatus = $this->config['status_numb']['Inactive'];
+                        break;
+                    case 'archived':
+                        $profileStatus = $this->config['status_numb']['Archived'];
+                        break;
+                    default:
+                        $profileStatus = $this->config['status_numb']['Active'];
+                        break;
+                    }
+                }
+
                 // Add the member info record
                 $insert = $this->wpdb->insert(
                     GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_info',
                     array(
                         'member'          => $memberId,
                         'member_name'     => $data['member_name'],
-                        'status'          => $this->config['status_numb']['Active'],
+                        'status'          => $profileStatus,
                         'reference_name'  => 'Imported Member Information',
                         'descr'           => $data['descr'],
                         'short_descr'     => $short_descr,