From: Steve Sutton Date: Thu, 24 May 2018 18:43:17 +0000 (-0400) Subject: Update for contact custom fields X-Git-Tag: v1.0.4^2~3 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=2efb8a770a37ad9918599462e0c03e8ed20a6e8c;p=WP-Plugins%2Fglm-member-db-fields.git Update for contact custom fields This will need some more work. --- 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], ),