=== modified file 'modules/system/system.install'
--- modules/system/system.install	2009-08-21 18:00:03 +0000
+++ modules/system/system.install	2009-08-22 16:00:04 +0000
@@ -2428,6 +2428,96 @@
 }
 
 /**
+ * Change profile.module fields into Field API fields.
+ */
+function system_update_7036() {
+  $ret = array();
+  
+  if (!db_table_exists('profile_field')) {
+    return $ret;
+  }
+  // Get all profile fields.
+  $fields = db_query('SELECT * FROM {profile_field} ORDER BY category, weight');
+
+  foreach ($fields as $old_field) {
+    // Create new fields using the field API.
+    $field = array(
+      'field_name' => $old_field->name,
+    );
+
+    // Create field instance on the user bundle.
+    $instance = array(
+      'field_name' => $field['field_name'],
+      'bundle' => 'user',
+      'description' => $old_field->explanation,
+      'label' => $old_field->title,
+      'required' => $old_field->required,
+      'weight' => $old_field->weight,
+    );
+
+    switch ($old_field->type) {
+      case 'textfield':
+        $field['type'] = 'text';
+        $instance['widget']['type'] = 'text_textfield';
+
+        // Only allow plain text.
+        $instance['settings']['text_processing'] = 0;
+        break;
+
+      case 'textarea':
+        $field['type'] = 'text_long';
+        $instance['widget']['type'] = 'text_textarea';
+        // Use the default text format.
+        $instance['settings']['text_processing'] = 1;
+        break;
+
+      case 'checkbox':
+        $field['type'] = 'list_boolean';
+        $instance['widget']['type'] = 'options_onoff';
+        // TODO: get allowed values.
+        break;
+
+      case 'selection':
+        $field['type'] = 'list_text';
+        $instance['widget']['type'] = 'options_select';
+        // TODO: get allowed values.
+        break;
+
+      case 'list':
+        $field['type'] = 'text';
+        $field['cardinality'] = FIELD_CARDINALITY_UNLIMITED;
+        break;
+
+      case 'date':
+      case 'url':
+        continue;
+    }
+
+    field_create_field($field);
+    field_create_instance($instance);
+  }
+
+  // Get old field values from the profile.module table.
+  $results = db_query('SELECT uid, name as field_name, value FROM {profile_field} f JOIN {profile_value} v ON f.fid = v.fid WHERE value IS NOT NULL');
+
+  $accounts = array();
+  foreach ($results as $result) {
+    $accounts[$result->uid]['uid'] = $result->uid;
+    $accounts[$result->uid][$result->field_name][0]['value'] = $result->value;
+  }
+
+  // Set new field values using the field API.
+  foreach ($accounts as $account) {
+    $account = (object) $account;
+    field_attach_update('user', $account);
+  }
+    
+  $ret[] = array('success' => TRUE, 'query' => "The profile module has been replaced by the new Fields UI. For additional functionality such as adding fields to the registration form and migrating from date and URL profile fields, install the Retro Profile module.");
+  
+  return $ret; 
+}
+
+/**
  * @} End of "defgroup updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */

