From 2efb8a770a37ad9918599462e0c03e8ed20a6e8c Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 24 May 2018 14:43:17 -0400 Subject: [PATCH] Update for contact custom fields This will need some more work. --- models/admin/import/fields.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/models/admin/import/fields.php b/models/admin/import/fields.php index 68eecc7..e27968c 100644 --- a/models/admin/import/fields.php +++ b/models/admin/import/fields.php @@ -238,9 +238,18 @@ class GlmMembersAdmin_import_fields extends GlmDataFieldsCustomFieldsData $customRow[0] ) ); + // 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 + ) + ); // get the active member info id - $memberInfoId = - $memberInfoData->getActiveInfoIdForMember( $memberId ); + // $memberInfoId = + // $memberInfoData->getActiveInfoIdForMember( $memberId ); $customFieldId = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT id @@ -249,11 +258,11 @@ class GlmMembersAdmin_import_fields extends GlmDataFieldsCustomFieldsData $customRow[1] ) ); - if ( $customFieldId ) { + if ( $customFieldId && $memberContactId ) { $newId = $this->wpdb->insert( GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . 'custom_field_data', array( - 'entity_id' => $memberInfoId, + 'entity_id' => $memberContactId, 'field_id' => $customFieldId, 'field_data' => $customRow[2], ), -- 2.17.1