Closed (fixed)
Project:
Profile 2
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Aug 2010 at 08:00 UTC
Updated:
16 Feb 2013 at 07:24 UTC
Jump to comment: Most recent file
Comments
Comment #1
jp.stacey commentedCould you give us more of an idea of what the problem is here? I'd be happy to work on it, but admin/structure/profiles/manage/main/fields already has weighting that works as far as I can tell.
Comment #2
joachim commentedThis is weighting on the actual profile types at admin/structure/profiles rather than their fields -- something AFAIK not seen in core.
Oh wait, vocabularies have weight don't they? So the same thing -- the actual FieldAPI bundles have weights to order them.
BTW, I saw fago synced CVS from my github, so CVS is now the main thing to work on, and I'll make commits there too.
Comment #3
jp.stacey commentedYeah, I realised shortly after fiddling with #894026: basic UI for editing / creating types the mistake i'd made with this ticket.
Well, if I can get entity API writing the profile names then a sortable table should be the next logical step.
Comment #4
jp.stacey commentedI can confirm based on work I've done on #894026: basic UI for editing / creating types that the admin interface needs work to provide weightings as per taxonomy. However, as that issue has already required me to edit the code for the main table UI, maybe we should weight for that issue to close before we work on this one, so we don't get merge problems. Thoughts?
Comment #5
jp.stacey commenteds/weight for/wait for/ . Whoops.
Comment #6
jp.stacey commentedWell, I went ahead and rolled a patch anyway. It shouldn't be hard to adapt when #894026: basic UI for editing / creating types is finished.
The basic idea is:
* Change the
hook_menucallback to bedrupal_get_form, withprofile2_overview_typesas its argument* Return a workable Form API array with weights from
profile2_overview_typesThis Form API array creates an ugly but accessible form. It's then themed as follows:
* Register a new theme function in
hook_theme, to match the form IDprofile2_overview_types* Write that theme function to take the Form API array and build a sortable table from it
* Write a submit function
profile2_overview_types_submitto write weightsFinally, to get
profile2_get_typesto respect those weights:* Add a function
profile2_type_sortto sort an array of profile types by weight* Implement that function via
uasortinprofile2_get_typesThis seems to work, but the main limiting factor is still that the profile in code doesn't get a new weight. See #798784: Remove default fields and use EntityDB API to install/uninstall a default profile, though.
Comment #7
fagoso, the UI has gone in. To update the current UI, we'd have to add additional overrides in the Profile2TypeUIController
Comment #8
BenK commentedHey everyone,
One note on this issue: The weight selected for the profile type should determine the order of the profile types on:
1. The user account page
2. The tabs at user/[uid]/edit
Currently, the default 'Profile' type is displayed at the top of the user account page (oldest profile type first), but at the far right of the tabs at user/[uid]/edit (oldest profile type last). So it would be best to make this ordering consistent based on the weight.
--Ben
Comment #9
mgiffordIs the patch against the CVS version of the code? I've got Profile2 in place on a site after discovering that D7 presently doesn't allow people to put fields on the user registration page.
I'm here because I can't drag the the fields from hidden to public spaces here /admin/structure/profiles/manage/main/display/account
I've only got 2 fields that seem to be able to be public, neither of which I seem to be able to control.
Comment #10
Jerome F commentedI was looking exactly for this feature I agree with BenK in #8 it's important that this order is used with the tabs on the user edit page. (Sorry I can't help during the need work step, but I can review the patch.)
Apparently it's using alphabetical order of the machine names so an interesting workaround in the meantime is to modify the machine names with numbers underscore for example 1_main, 2_whatever, 3_etc
Comment #11
scottrouse commentedAny progress on this? Seems like a fairly reasonable feature request. Subscribe.
Comment #12
fagowell, at least we should expose the setting in the UI I guess.
Attached is a patch which does that + adds the user-profile stuff via the user-account extra fields. Thus, the weight really is just relevant for ordering the edit-tabs.
Comment #13
fagoops, wrong patch. This is the right one.
Comment #14
fagoAny feedback on this?
Comment #15
mgiffordHey @fago,
I pulled down the git repository then tried to apply it:
Don't think I did anything wrong here, but....
Comment #16
fagook, I've re-rolled it.
Comment #18
fago#16: profile2_weight.patch queued for re-testing.
Comment #19
apatrinos commentedComment #20
joachim commentedRestoring issue title.
Also, note there is no longer any need to subscribe -- just click 'follow' at the top.
Comment #22
faqing commentedThe updated version 7.x-1.2 still has problem to weight the profile type.
Comment #23
interx commentedThe patch seems to work, but I get a notice when visiting the user account "Manage fields" page.
I don't see anywhere in code where user_view would be added to $data. Is this a patch for 7.x-1.x-dev? Anyhow, removing the entire if() works for 7.x-1.2.
Comment #24
brayo4 commentedi had some success using phpmyadmin and manually changing the values there. look for this table: profile_type
Comment #25
eric.smith commentedOn a previous site, I had sorted these in the theme which was an ugly solution.
Thanks to brayo4's tip in #14, I'm handling this on my current project with a simple module:
where you just need to set the keys and values in the $profile_weights array to your profile types and and weights.
Comment #26
Québec commentedThanks for this solution.
But how does a non coder deals with this «module»? Any link to some explanations on how to use this king of «module»? Thanks.
Comment #27
dman commentedThis is still needed.
Thanks for the patch. all straightforward stuff there.
Ditto to #23 . Not only is 'user_view' undefined, it is nowhere else in the codebase.
Here is a clean re-roll against todays dev, with the bogus 'user_view' removed.
Managing user account display over in admin/config/people/accounts/display now lets me position the extra profile section where I want it.
Comment #28
joachim commentedI don't understand what hook_field_extra_fields() is doing in this patch, so I guess there's even less chance of understanding what it's doing in a month's time in the wider context of the module. Could it get a comment to explain what it's doing?
It would be nice if we had the draggable UI too -- though I've been thinking about this and I reckon that could/should be done in EntityAPI: see #1659456: support for hierarchical entities.
Comment #29
dman commentedhook_extra_fields is what allows the UI to define what order the profile chunks show up in on the user account page.

Works as desired here!
Comment #30
joachim commentedYes, I know that's what it does.
But it would be nice to comment the bits like
> $extra['user']['user']['form']['profile_' . $type_name]
to say just where the extra field is being added.
Comment #31
dman commentedI believe - from looking at it, and hook_extra_fields that
>$extra['user']['user']['display']['profile_' . $type_name]
represents
Comment #32
ljungan80 commentedWill this be added to the next version of profile2?
Comment #33
westbywest commentedI can confirm dman's patch in #27 lets me add weights to profile2's for displaying a user's account. Awesome! However, these weight do not appear to get captured when the profile2 and contained fields are exported to a feature.
Comment #34
clemens.tolboomI added comment to hook_info_extra_fields.
This patch fixes weight settings @ x affecting y
- admin/config/people/accounts/display : viewing a user
- admin/config/people/accounts/fields : register a user with profile types
- admin/structure/profiles : editing a user by ordering the tabs for profile types
[edit]
The description could use some rephrase as these values only affect user/%/edit right?
Comment #35
dman commentedBeing able to order the tabs is a useful addition too. Good thought!
Comment #36
clemens.tolboom@dman: please RTBC if possible :)
Comment #37
Québec commentedHi,
I applied the patch from #34. I works great for User-1. But other users get random results...
Is it save to put back original files from Profile_2?
Thanks
Comment #38
clemens.tolboom@Québec what do you mean with random result? On what pages. See the list on #34.
Please give more feedback on the errs then set issue to status: Needs work. Tnx.
You can revert back to original files. I'm not 100% sure as extra fields are defined which must be cleared so probably a 'Cache Clear All' does the job.
Comment #39
drupalycious commentedHello,
the patch #34 works for me, I also check the users'accounts and the profile types get re-ordered as expected at their level too.
One thing that could be improved would be to display the profile types weight number directly in the profile types list page as an extra column, in spite of having to open each profile types to modify its weight.
Thanks
Comment #40
clemens.tolboom@sp-drupy: Thanks for reviewing. Have you tested for UID <> 1 too as @Québec noted?
(I agree with the weight settings in the lists but that is afaik done by the entity API module.)
If you think the patch works as expected please mark as RTBC.
Comment #41
drupalycious commentedYes I tested both as admin and as normal users, and it seems ok on my side,
maybe some feedback from others before marking RTBC.
Comment #42
Québec commentedSorry for this post. I rarely get results with patches. I certainly made a mistake. I will wait for the next version of the module. Again, sorry for wasting your time.
Comment #43
clemens.tolboomSteps to configure after applying the patch:
I'm not sure what the relation is between the weights set on admin/structure/profiles versus config/people/accounts/fields (I guess the first sets the defaults of the latter. I clear cache to late)
I RBTC as @sp-drupy said it works and I have re-tested and move it into production based on 7.x-1.2
Comment #44
Québec commentedHi,
I tried again and it worked. The patch did the job.
My mistake came from the fact (I think) that I applied the patch to 7.x-1.2 instead of applying the patch to the Dev. version.
Is the dev. version safe to use on a production site?
Thanks.
Comment #45
clemens.tolboomI personally dislike using dev versions as it is hard to revert to an older version as you cannot download a zipped version.
I've applied the patch to 7.x-1.2 + 894904-34 according to my log.
Comment #46
faqing commentedPlease consider to release a new version with the above patch applied.
Comment #47
clemens.tolboomYou should not change the version. The patch applies to the dev version :-)
The project owner should take this one from now on.
Comment #48
westbywest commentedThis issue was filed in August 2010, and a working patch was submitted in June 2012. I've already shipped patch #27 in a production site that went online earlier this year, since I didn't have a better workaround.
However, nothing appears to have been committed by the maintainers to the 7.x branch of this module since May 2012. All commits since then have been to the 8.x branch.
Would the proposed resolution be more readily accepted if one were to submit an 8.x version of the patch, so that it could be backported to 7.x?
Comment #49
clemens.tolboom@westbywest that's a good question.
As the patch is RTBC the maintainers could have indicated for a 8.x patch ... unfortunately nothing happened to this RTBC state so we are stuck.
You could try to create a 8.x patch yourself. That probably helps move this forward. I myself have no time/money left to help you with this :-(
Comment #50
Pascoual commentedPatch #34 applied on 1.2 and instructions #43 followed, works great.
Thank you clemens.tolboom !
Comment #51
Alpinist1974 commentedThanks, Clemens!
Your patch works perfectly.
Comment #52
fagosry for letting this lie so long. I gave it a test and noted that it didn't work when profile2 pages module is enabled for a profile type. Thus I added a check for the userView option and an according cache clear such that it gets updated when necessary.
Committed, thanks.
Comment #53
clemens.tolboom@fago thanks ... we even have a release :)
Comment #55
jami3z commentedin #29, @dman how did you get all your profile types display settings to show? ie Set the display for each of your profile types. When I try all this I only get the default option to configure. None of my other profile types show for me to me able to manage the display for each.
Comment #56
dman commentedI don't think there was anything special. If Patch #34 went in, and you are using a version that has that, then each profile type should have its own draggable section on the form and field management UIs