#8623 closed defect (bug) (fixed)
Profile Fields "Custom" Sort Order not working since 10.0
Reported by: | niftythree | Owned by: | imath |
---|---|---|---|
Milestone: | 10.1.0 | Priority: | normal |
Severity: | normal | Version: | 10.0.0 |
Component: | Core | Keywords: | has-patch commit |
Cc: |
Description
Hello,
Since updating to BuddyPress 10.0, the "Custom" sort order for all profile fields is no longer working.
On the backend when editing a profile field, the options will be listed in the chosen order. However, on the front end (and on the backend, when not editing) the options always appear to be sorted in ascending order, even though "Ascending" is not selected. Changing the "sort order" to "Descending" works as it should, but "Custom" doesn't work; the options will always be displayed in ascending order.
Any chance this could be addressed soon, please? π
Thanks.
Attachments (2)
Change History (16)
#2
@
3 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 10.1.0
Hi @niftythree,
I was able to reproduce this problem. I think we can simply add a condition to check if order is custom.
#3
@
3 years ago
This regression was introduced by me at βhttps://buddypress.trac.wordpress.org/changeset/13147 I was actually not aware that you could have custom sort options there. However, the sorting defaults to ASC, even if they are custom, so Iβm not sure what custom
means in that scenario.
This ticket was mentioned in βSlack in #buddypress by imath. βView the logs.
3 years ago
#5
@
3 years ago
@oztaser I uploaded another patch to revert the regression. Your patch looked good, but it could still add issues in case someone else used a different custom order_by slug.
#6
@
3 years ago
Hi @espellcaste,
You are totally right and your patch looks great to me. Thanks for the improvement.
#7
@
3 years ago
- Keywords commit added
Sorry @oztaser I was so tired yesterday I haven't noticed you submitted a patch π.
@espellcaste your patch doesn't fix the issue, because bp_esc_sql_order()
returns "ASC" or "DESC", so it's always one of these into your statement and never "custom" π¬.
Many thanks to you both for your work on it, it helped me understand what was going wrong, I was looking at fields order, although it was options order...
If no objections, let's commit this in 10.0 branch and trunk.
#8
@
3 years ago
Thanks @imath, that's what I tried to explain in Slack thread and fix in my patch. I don't know how I've reviewed 8623.diff and how I missed the main point π€¦. We are lucky to have you! Thanks again.
#9
@
3 years ago
@imath
Both patches (actually all patches provided here) accomplsh the same thing, just differently: it defaults to ASC
for custom options.
My patch does not remove the custom
key or skip it. It defaults to ASC
just like yours do. If you check $this->order_by
before or after sanitizing it makes no difference.
#10
@
3 years ago
@espellcaste
Sorry to insist but when Iβve tested yours the first condition was always true with the custom order. So it was always sorted by name and not by order_option.
'ASC' === bp_esc_sql_order( βcustomβ )
is the same as βASCβ === Β΄ASCβ
π
#11
@
3 years ago
@imath Thank you for the insistance. You are most certainly correct. Upon a closer review, my patch is the one that does not work.
#13
@
3 years ago
- Owner set to imath
- Resolution set to fixed
- Status changed from new to closed
In 13231:
Should have mentioned that we're using the legacy template.
Thanks.