Index: fieldgroup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/fieldgroup.module,v
retrieving revision 1.1.2.11
diff -u -r1.1.2.11 fieldgroup.module
--- fieldgroup.module	27 Jan 2007 21:19:54 -0000	1.1.2.11
+++ fieldgroup.module	7 Feb 2007 16:35:32 -0000
@@ -322,3 +322,18 @@
   }
   return FALSE;
 }
+
+/*
+ * Duplicates all fieldgroups, used when content types are duplicated
+ */
+function fieldgroup_duplicate($original_content_type, $content_type) {
+  foreach (fieldgroup_groups($original_content_type) as $group_name => $group) {
+    db_query("INSERT INTO {node_group} (type_name, group_name, label, settings, description, weight)
+              VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $content_type, $group_name, $group['label'], serialize($group['settings']), $group['description'], $group['weight']);
+    foreach ($group['fields'] as $field_name => $field) {
+      db_query("INSERT INTO {node_group_fields} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')",
+            $content_type, $group_name, $field_name);
+    }
+  }
+  cache_clear_all('fieldgroup_data');
+}
Index: content_admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/content_admin.inc,v
retrieving revision 1.12.2.33
diff -u -r1.12.2.33 content_admin.inc
--- content_admin.inc	4 Feb 2007 02:21:24 -0000	1.12.2.33
+++ content_admin.inc	7 Feb 2007 16:35:32 -0000
@@ -185,6 +185,9 @@
       // and move existing fields to separate shared table, if not already shared
       _content_admin_field_add_existing_submit('_content_admin_field_add_existing', $field_values);
     }
+    if (module_exist('fieldgroup')) {
+      fieldgroup_duplicate($form_values['original_type_name'], $form_values['type_name']);
+    }
   }
 
   drupal_set_message(t('Saved content type %type.', array('%type' => theme('placeholder', $form_values['label']))));
