Switch back to member info
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 31 May 2018 12:40:16 +0000 (08:40 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 31 May 2018 12:40:16 +0000 (08:40 -0400)
Will need this to be an import select (member or contact)

models/admin/import/fields.php

index e27968c..ad9eb0c 100644 (file)
@@ -238,18 +238,19 @@ class GlmMembersAdmin_import_fields extends GlmDataFieldsCustomFieldsData
                                 $customRow[0]
                             )
                         );
+                        echo '<pre>$memberId: ' . print_r( $memberId, true ) . '</pre>';
                         // We need to get the contact id now
-                        $memberContactId = $this->wpdb->get_var(
-                            $this->wpdb->prepare(
-                                "SELECT id
-                                   FROM " . GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts
-                                  WHERE ref_dest = %d",
-                                $memberId
-                            )
-                        );
+                        // $memberContactId = $this->wpdb->get_var(
+                        //     $this->wpdb->prepare(
+                        //         "SELECT id
+                        //            FROM " . GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts
+                        //           WHERE ref_dest = %d",
+                        //         $memberId
+                        //     )
+                        // );
                         // get the active member info id
-                        // $memberInfoId =
-                        //     $memberInfoData->getActiveInfoIdForMember( $memberId );
+                        $memberInfoId = $memberInfoData->getActiveInfoIdForMember( $memberId );
+                        echo '<pre>$memberInfoId: ' . print_r( $memberInfoId, true ) . '</pre>';
                         $customFieldId = $this->wpdb->get_var(
                             $this->wpdb->prepare(
                                 "SELECT id
@@ -258,11 +259,12 @@ class GlmMembersAdmin_import_fields extends GlmDataFieldsCustomFieldsData
                                 $customRow[1]
                             )
                         );
-                        if ( $customFieldId && $memberContactId ) {
+                        echo '<pre>$customFieldId: ' . print_r( $customFieldId, true ) . '</pre>';
+                        if ( $customFieldId && $memberInfoId ) {
                             $newId = $this->wpdb->insert(
                                 GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX .  'custom_field_data',
                                 array(
-                                    'entity_id'  => $memberContactId,
+                                    'entity_id'  => $memberInfoId,
                                     'field_id'   => $customFieldId,
                                     'field_data' => $customRow[2],
                                 ),