Update the clone custom fields function.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 2 Mar 2018 15:05:06 +0000 (10:05 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 2 Mar 2018 15:05:06 +0000 (10:05 -0500)
Should be getting the custom field data not just the fields.

classes/customFieldPluginSupport.php

index 7b0569c..d4c70c0 100644 (file)
@@ -21,8 +21,6 @@ function customFieldsSaveFields( $entityID ){
     if ( !isset( $_REQUEST['glm_custom_field'] ) ) {
         return false;
     }
-    //echo "Trying to save entity of type $uid";
-//    print_r(customFieldsGetFields($entityID));
     // See if this memberInfo has current field data
     $currentCustomFields = customFieldsGetFieldData( $entityID );
     // Insert the custom field record
@@ -98,7 +96,7 @@ function customFieldsSaveFields( $entityID ){
 function customFieldsCloneFields( $oldId, $newId )
 {
     global $wpdb;
-    $customFields = customFieldsGetFields( $oldId );
+    $customFields = customFieldsGetFieldData( $oldId );
     $fieldDataFormat = array(
         '%d',
         '%d',
@@ -174,5 +172,5 @@ function customFieldsGetFields( $entityID, $where = ' AND true ', $uid )
       FROM " . GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . "custom_fields
       WHERE id IN (select field_id from ".GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . "custom_field_data WHERE entity_id = %d)" . $where;
     $fieldData = $wpdb->get_results( $wpdb->prepare( $sql, $uid ), ARRAY_A );
-    echo '<pre>',  print_r($fieldData), '</pre>';
+    // echo '<pre>',  print_r($fieldData), '</pre>';
 }