Index: content_profile_useredit.module =================================================================== --- content_profile_useredit.module (current) 2010-04-16 12:32:41.373816335 +0300 +++ content_profile_useredit.module (new) 2010-04-16 13:00:10.165817732 +0300 @@ -104,10 +104,19 @@ */ function content_profile_useredit_add_profile_form($type, &$form, &$form_state) { // Load node and add in its form. - global $language; - $node = content_profile_load($type, $form['#uid'], $language->language); - + if (module_exists('translation') && translation_supported_type(type)) { + global $language; + $node = content_profile_load($type, $form['#uid'], $language->language); + } + else { + $node = content_profile_load($type, $form['#uid']); + } + // Get the original node form. + if(empty($node)) { + return; //just in case + } + $node_form = drupal_retrieve_form($type .'_node_form', $form_state, $node); drupal_prepare_form($type .'_node_form', $node_form, $form_state); $node_form += array('#field_info' => array()); @@ -130,7 +139,8 @@ $form_add['title'] = $node_form['title']; // Add more values @see node_form - foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) { + // Don't use uid here or you'll get the "Detected malicious attempt to alter protected user fields." warning + foreach (array('nid', 'vid', 'created', 'type', 'language') as $key) { $form_add[$key] = $node_form[$key]; } @@ -157,7 +167,7 @@ unset($form_add[$field_name]); } } - + // Add in the new form elements into $form. $form += array('#field_info' => array()); $form['#field_info'] += $node_form['#field_info']; @@ -177,6 +187,8 @@ foreach (element_children($form_add) as $key) { $form['#content_profile_weights'] += array($key => $weight); } + // Unset uid or you'll get the "Detected malicious attempt to alter protected user fields." warning + unset($form['uid']); } /** @@ -187,8 +199,10 @@ */ function content_profile_useredit_alter_weights($elements) { foreach ($elements['#content_profile_weights'] as $key => $weight) { - $elements[$key] += array('#weight' => 0); - $elements[$key]['#weight'] = $weight + $elements[$key]['#weight'] / 1000; + if($key != 'uid') { //skip uid or it will crash + $elements[$key] += array('#weight' => 0); + $elements[$key]['#weight'] = $weight + $elements[$key]['#weight'] / 1000; + } } return $elements; }