Index: modules/forum/forum.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.install,v
retrieving revision 1.48
diff -u -r1.48 forum.install
--- modules/forum/forum.install	24 Jun 2010 12:59:22 -0000	1.48
+++ modules/forum/forum.install	30 Jun 2010 02:58:58 -0000
@@ -24,6 +24,10 @@
  * Implements hook_enable().
  */
 function forum_enable() {
+  // If we enable forum at the same time as taxonomy we need to call
+  // field_associate_field as otherwise the field won't be enabled until
+  // hook modules_enabled is called which takes place after hook_enable events.
+  field_associate_fields('taxonomy');
   // Create the forum vocabulary if it does not exist.
   $vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', 0));
   if (!$vocabulary) {
@@ -56,28 +60,6 @@
     );
     field_create_field($field);
 
-    $instance = array(
-      'field_name' => 'taxonomy_' . $vocabulary->machine_name,
-      'entity_type' => 'node',
-      'label' => $vocabulary->name,
-      'bundle' => 'forum',
-      'required' => TRUE,
-      'widget' => array(
-        'type' => 'options_select',
-      ),
-      'display' => array(
-        'default' => array(
-          'type' => 'taxonomy_term_reference_link',
-          'weight' => 10,
-        ),
-        'teaser' => array(
-          'type' => 'taxonomy_term_reference_link',
-          'weight' => 10,
-        ),
-      ),
-    );
-    field_create_instance($instance);
-
     variable_set('forum_nav_vocabulary', $vocabulary->vid);
 
     // Create a default forum so forum posts can be created.
@@ -90,6 +72,30 @@
     $term = (object) $edit;
     taxonomy_term_save($term);
   }
+
+  // Create the instance on the bundle.
+  $instance = array(
+    'field_name' => 'taxonomy_' . $vocabulary->machine_name,
+    'entity_type' => 'node',
+    'label' => $vocabulary->name,
+    'bundle' => 'forum',
+    'required' => TRUE,
+    'widget' => array(
+      'type' => 'options_select',
+    ),
+    'display' => array(
+      'default' => array(
+        'type' => 'taxonomy_term_reference_link',
+        'weight' => 10,
+      ),
+      'teaser' => array(
+        'type' => 'taxonomy_term_reference_link',
+        'weight' => 10,
+      ),
+    ),
+  );
+  field_create_instance($instance);
+
   // Ensure the forum node type is available.
   node_types_rebuild();
   $types = node_type_get_types();
