Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Thanks for a really great module!
Do you have any suggestions for how to adjust the ordering of fields on the registration page when some fields are created by core like the username and email address fields?
Best, Paul
Comments
Comment #1
grasmash CreditAttribution: grasmash commentedYou should be able to control the weight of the P2RP fieldset via the UI, as well as the weights the core fields.
You can find a discussion here: #1674970: reg form output order when using additional non-profile2 profile fields.
For the best control, I would suggest using FAPI to change element weights. If that does not work, please describe your issue in more detail.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks for the reply :)
I can use the UI or the FAPI to arrange core fields and profile2 fields separately but I can't rearrange them all together i.e.
#Registration form
First Name [profile2]
Second Name [profile2]
Username [Core]
Email Address [Core]
.. other profile 2fields
Best, Paul
Comment #3
BazzeFTW CreditAttribution: BazzeFTW commentedI'm having the same issue.
Comment #4
grasmash CreditAttribution: grasmash commentedAs long as you don't wrap P2RP fields in a fieldset, the core field weights and profile2 field weights should respect eachother. Are the fields in a fieldset? Can you check the markup?
Comment #5
stutibhavsar CreditAttribution: stutibhavsar commentedI am also facing the same problem. The profile 2 fields are wrapped in a fieldset. I can change the core fields weight but not the profile 2 fields.
Please advice on the same.
Comment #6
grasmash CreditAttribution: grasmash commentedOk, it seems like this request is getting some critical mass. I'll look into the issue this weekend.
Comment #7
hawkeye217 CreditAttribution: hawkeye217 commentedHaving the same issue on a fresh install of D7 and profile2-2.x-dev. I created a P2 field called "name" with a weight of -100 and the core registration username/password fields set at their default of -10. No fieldsets. The registration form still displays the core fields before the p2 field. Unless that's by design...
I haven't tried using form_alter's #weight yet...
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedDid you have a look into this? This is something that I now need to try and fix.
Best, Paul
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedWork around I found for a project ..
Comment #10
mortona2k CreditAttribution: mortona2k commentedThanks Paul,
I'm a little surprised that this works:
$form['#submit'][] = 'ourgamefootball_form_profile2_form_submit';
Since it's operating after all the other form validation and submission handlers. But it seems to work, so thanks a ton for documenting it!
Comment #11
ssoulless CreditAttribution: ssoulless commentedtested, #9 works
Comment #11.0
ssoulless CreditAttribution: ssoulless commentedForgot to mention that this refers to the registration page
Comment #12
DrCord CreditAttribution: DrCord commentedThe fix in #9 worked for me. I needed to move a profile 2 field from one profile section to another for a client on only the registration page...nothing else seemed to work, but this did! Thanks @paulbooker
Comment #13
grasmash CreditAttribution: grasmash at Acquia for U.S. Department of Justice commentedThis issue has no patched, and so should not be marked as "reviewed and tested by community".