# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
--- W:\Drupal\modules\6.x\Content Construction Kit\content_profile\6.x-1.0\content_profile\content_profile.module
+++ W:\Drupal\modules\6.x\Content Construction Kit\content_profile\6.x-1.0 patched\content_profile\content_profile.module
@@ -319,8 +348,40 @@
         }
       }
       break;
+
+    /************** PATCH to load profile fields into user object on user_load() call */
+    case 'load':
+      $types = "('" . implode("', '", array_keys(content_profile_get_types())) . "')";
+      $result = db_query("SELECT nid FROM {node} WHERE uid = %d AND type IN $types", $account->uid);
+      while ( $nid = db_result($result) ) {
+        $node = node_load($nid);
+        foreach ( $node as $key => $value ) {
+          if ( strpos($key, 'field_') === 0 ) {
+            if ( count($value) == 1 && isset($value[0]) ) { // single value field
+              if( count($value[0]) == 1 ) {                 // only one item in the value, so just grab it.
+                $value_keys = array_keys($value[0]);
+                $value = $value[0][$value_keys[0]];
   }
+              else {                                        // multiple items in the single value, so preserve the keys
+                $value = $value[0];
 }
+            }
+            else {                                          // more than one value in the field
+              foreach ( $value as $index => &$item ) {      // so for each item
+                if ( count($item) == 1 ) {                  // if its got only one attribute
+                  $value_keys = array_keys($item);          // grab just that attribute
+                  $item = $item[$value_keys[0]];
+                }
+              }                                             // otherwise the field values cannot
+            }                                               // be flattened so just leave them be
+            $account->$key = $value;
+          }
+        }
+      }
+      break;
+    /************* End PATCH *******************************************************/
+  }
+}

 /**
  * The original node_delete() function uses node_load() to get the $node object.
