The module is not working with multiple profiles because if, for example, we have two profiles and the first is checked for "show this profile as part of user account form" and the other not, on user/edit, the tab to modify the second profile points to the first profile, even if it has been placed in the main edit form.
This isssue is due the fact that on "account_profile_form_user_profile_form_alter", it is not checked if we are on the main edit form or in the profile edit subpage.
I don't know git,l so I show here the correct code.
I ask to someone that knows it to send the correct patch.

account_profile.module

function account_profile_form_user_profile_form_alter(&$form, &$form_state) {

+  if($form['#user_category']=="account") {
    
     $types = profile2_get_types();

     // We take care of profiles weights.
     usort($types, 'account_profile_sort_profile_by_weight');

     foreach ($types as $type) {

       // @var $type ProfileType
       if (isset($type->data['use_one_page']) && $type->data['use_one_page']) {

         $profile = profile2_load_by_user($form['#user'], $type->type);

         if (empty($profile)) {
           $profile = profile_create(array('type' => $type->type, 'uid' => $form['#user']->uid));
         }

         if (profile2_access('edit', $profile, $form['#user'])) {

           if (!isset($form_state["profiles"])) {
             $form_state["profiles"] = array();
           }

           $form_state['profiles'][$profile->type] = $profile;
           profile2_attach_form($form, $form_state);
         }
        }
      }
+  }
}

Comments

rollingnet’s picture

Issue summary: View changes
ryandekker’s picture

Status: Active » Needs review
StatusFileSize
new1.95 KB

Here's a patch for the above code (slightly cleaned up). Works for me against 7.x-2.0.

jygastaud’s picture

The patch in #2 works for me.

Thanks.

burgs’s picture

Status: Needs review » Reviewed & tested by the community

Yeah, this patch solves the issue. Thanks :)

hargobind’s picture

Also confirming this works.

  • ryandekker authored 365513e on 7.x-2.x
    Issue #2284041 by ryandekker: Wrong behavior with multiple profiles
    
kenorb’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.