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
Comment #1
rollingnet commentedComment #2
ryandekker commentedHere's a patch for the above code (slightly cleaned up). Works for me against 7.x-2.0.
Comment #3
jygastaud commentedThe patch in #2 works for me.
Thanks.
Comment #4
burgs commentedYeah, this patch solves the issue. Thanks :)
Comment #5
hargobindAlso confirming this works.
Comment #7
kenorb commented