Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7428 closed defect (bug) (fixed)

XProfile: a group's first field becomes last after save

Reported by: sgr33n's profile SGr33n Owned by: offereins's profile offereins
Milestone: 2.8 Priority: normal
Severity: normal Version:
Component: Extended Profile Keywords:
Cc: lmoffereins@…

Description

Hi,
Looks strange nobody yet reported this, I searched but nothing similar found, so sorry if it's a duplicate.
Anyway when you have multiple profile fields, if you update the "Name" field (the main field, the one with id 0 on the bp_xprofile_fields table) it will order automatically as last. I took a look at the DB and on the bp_xprofile_fields table the field_order becames e.g. 3 in a 3 fields configuration.

Thanks

Attachments (1)

7428.01.patch (822 bytes) - added by Offereins 7 years ago.

Download all attachments as: .zip

Change History (8)

#1 @dontdream
7 years ago

I've seen that happen with other profile fields too. After updating an existing profile field, *sometimes* I've seen it move to the last position in its field group.

I didn't submit a bug report because I wasn't able to consistently reproduce the issue, but now I confirm I can reproduce it editing the Name field (field_id=1).

Version 0, edited 7 years ago by dontdream (next)

#2 @DJPaul
7 years ago

  • Component changed from Core to Extended Profile
  • Keywords good-first-bug added
  • Milestone changed from Awaiting Review to 2.9

Yep. Good report, I can recreate too.

#3 @Offereins
7 years ago

  • Cc lmoffereins@… added

For a long time I've tolerated this bug, but the time has come to fix it. My first guess would be that the zero-based indexing of fields within the fieldgroup (this concerns all fieldgroups) is to blame. BP's logic would read that the field your editing has a falsey value for $field_order, thus BP considers it new and pushes it to the end of the field list. Will investigate further.

Edit: my guess was correct. Patch incoming.

Last edited 7 years ago by Offereins (previous) (diff)

@Offereins
7 years ago

#4 @Offereins
7 years ago

  • Keywords has-patch added; good-first-bug removed

I've attached the smallest patch possible which fixes the bug described. Further sanitization of data types is needed in the saving of profile fields (and groups), but that's for later.

#5 @boonebgorges
7 years ago

I've noticed this too. The approach in 7428.01.patch seems sensible as a first step toward better sanitization.

#6 @offereins
7 years ago

  • Owner set to offereins
  • Resolution set to fixed
  • Status changed from new to closed

In 11409:

XProfile: keep the field order value on save

Fixes a bug where the group's first field would be pushed to the bottom of
the field order stack on field save.

Fixes #7428

#7 @Offereins
7 years ago

  • Keywords has-patch removed
  • Milestone changed from 2.9 to 2.8
  • Summary changed from Modifing the Name user profile field to XProfile: a group's first field becomes last after save
Note: See TracTickets for help on using tickets.