I have user profile categories at admin/user/profile specified in a given order - let's say A-B-C-D. At admin/settings/onepageprofile I have the same A-B-C-D order for these categories. These setting will be honoured when *editing* a user profile, however when viewing a profile, the categories appear in a random order (D-C-A-B). They should of course also appear in the same order instead (A-B-C-D).
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | onepageprofile-793600.patch | 895 bytes | jantoine |
Comments
Comment #1
aidanlis commentedThis module is only for the edit page, as the profile page is already on one page.
I do agree with you, it makes sense to have them in the same order, but there's no easy way to do it because there's no correlation between the edit fieldsets and the $account structured arrays. If someone wants to provide a patch, or sponsor the development, I'm happy to implement it. Until then I'll setting this as won't fix.
Comment #2
StormPOP commentedroball,
I was wondering the same thing when I can across this issue. I have a solution that isn't perfect, but it's pretty simple and it worked perfectly for me.
Step 1) get the file user-profile.tpl.php from /modules/user
Step 2) in line 45 of the code (at least for my version, if its different it should still be easy to find because there is only a couple lines of real code) delete "print $user_profile;" and replace it with "print_r ($profile);". This will give you all of the array keys.
Step 3) Go to the View tab for your profile. You will see something like this...
Array ( [user_picture] =>
[summary] =>
Member since
October 2010
[simplenews] =>
Newsletters
Current subscriptions
My Newsletter
[User Details] =>
......and so on.
Step 4) Now go back to editing the file user-profile.tpl.php by deleting "print_r ($profile);" and replacing it with "print $profile['REPLACE WITH ARRAY KEY']" for each bracketed array key that you want to include, in the proper order. For example the actual code in my user-profile.tpl.php file looks something like this...
It worked like a charm for me so hopefully others can find this useful.
One obvious shortfall I can imagine is that you would need to edit this if additional profile categories are added in the future.
Comment #3
jantoine commentedThis is precisely what hook_profile_alter() is for. Patch attached.
Cheers,
Antoine
Comment #4
roball commentedYeah, your patch works perfectly. The solution seems very easy :-)
So can this patch please be committed? Thank you!
Comment #5
dan3h commentedThis patch worked great for me too. Thanks, @AntoineSolutions!
Comment #6
roball commentedPlease commit. Or is this module already abandoned?
Comment #7
aidanlis commentedNot abandoned, but I don't have time to do anything on this module at the moment. Send me an email in a week.
Comment #8
aidanlis commentedHooray.