From ee5c2f7e6c81ddac8f6fa869fd99f2421e06ce73 Mon Sep 17 00:00:00 2001 From: Dipen Date: Sun, 16 May 2010 04:11:28 +0530 Subject: [PATCH] CCK3 multigroup issue with content profile --- .../modules/content_profile_registration.module | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sites/all/modules/contrib/content_profile/modules/content_profile_registration.module b/sites/all/modules/contrib/content_profile/modules/content_profile_registration.module index 537f6d7..42bfb08 100644 --- a/sites/all/modules/contrib/content_profile/modules/content_profile_registration.module +++ b/sites/all/modules/contrib/content_profile/modules/content_profile_registration.module @@ -112,7 +112,6 @@ function content_profile_registration_add_profile_form($type, &$form, &$form_sta $node_form += array('#field_info' => array()); $form_add = array(); - // If non-CCK form elements are hidden, only copy over the CCK stuff if (in_array('other', content_profile_get_settings($type, 'registration_hide'))) { foreach ($node_form['#field_info'] as $field_name => $info) { @@ -144,7 +143,23 @@ function content_profile_registration_add_profile_form($type, &$form, &$form_sta // Hide fields as configured foreach (content_profile_get_settings($type, 'registration_hide') as $field_name) { if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type, $field_name))) { - unset($form_add[$group_name][$field_name]); + if(module_exists('content_multigroup') && !empty($form_add['#multigroups']) && array_key_exists($group_name,$form_add['#multigroups'])) { + unset($form_add[$group_name]['#group_fields'][$field_name]); + if(count(element_children($form_add[$group_name]['#group_fields'])) == 0) { + unset($form_add[$group_name]); + unset($form_add['#multigroups'][$group_name]); + } + if(count(element_children($form_add['#multigroups'])) == 0) { + unset($form_add['#multigroups']); + $key = array_search('content_multigroup_node_form_pre_render',$form_add['#pre_render']); + unset($form_add['#pre_render'][$key]); + $key = array_search('content_multigroup_node_form_after_build',$form_add['#after_build']); + unset($form_add['#after_build'][$key]); + } + } + else { + unset($form_add[$group_name][$field_name]); + } if (count(element_children($form_add[$group_name])) == 0) { unset($form_add[$group_name]); } -- 1.7.0.4