Index: C:/xampp/htdocs/erfa-utv/sites/all/modules/content_profile/modules/content_profile_edit.module =================================================================== --- C:/xampp/htdocs/erfa-utv/sites/all/modules/content_profile/modules/content_profile_edit.module (revision 241) +++ C:/xampp/htdocs/erfa-utv/sites/all/modules/content_profile/modules/content_profile_edit.module (working copy) @@ -16,8 +16,13 @@ $form += array('#field_info' => array()); foreach ($profile_types as $type => $typename) { - // Initialize new node: - $node = array('uid' => 0, 'name' => '', 'type' => $type); + + //Load existing node, Based on Content Profile Type and the userid + $node = content_profile_load($type, $form['#uid']); + // create a dummy object if the user has not created this profile type yet + if (!$node) { + $node = array('uid' => $form['#uid'], 'name' => $form['account']['name']['#default_value'], 'type' => $type); + } // Get the node form $node_form = drupal_retrieve_form($type .'_node_form', $form_state, $node); drupal_prepare_form($type .'_node_form', $node_form, $form_state); @@ -142,14 +147,16 @@ /** * Submits the user edit form */ function content_profile_edit_user_edit_submit($form, &$form_state) { foreach (content_profile_get_types('names', 'edit_use') as $type => $typename) { if ($node = &$form_state['content_profile_edit'][$type]['node']) { - // Set user's information for the node. - $node->title = $form_state['user']->name; - $node->uid = $form_state['user']->uid; - $node->name = $form_state['user']->name; - + // Set necessary information for the node. + $node->title = $form['_account']['#value']->name; + $node->uid = $form['_account']['#value']->uid; + $node->name = $form['_account']['#value']->name; + $node->vid = $form['#node']->vid; + $node->nid = $form['#node']->nid; + // Create the node. $node = node_submit($node); node_save($node);