Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 4 years ago

#6137 closed defect (bug) (fixed)

xprofile_insert_field() & BP_XProfile_Field->save() work incorrectly

Reported by: slaFFik Owned by: boonebgorges
Milestone: 2.3 Priority: high
Severity: normal Version:
Component: Extended Profile Keywords: needs-unit-tests
Cc:

Description

When you pass is_default_option to xprofile_insert_field() function, it's not saved into the DB.
Reason: xprofile_insert_field() initializes and pass is_default_option (among others) to BP_XProfile_Field and to its save() method, but there is no use or even mention of is_default_option.

So it's impossible right now using xprofile_insert_field() to save options defaults for fields. Currently we need to use additional xprofile_field_default_before_save filter for that.

OR

We need to have a separate function like xprofile_insert_field_option() that will flatten that (rather) complicated logic in BP_XProfile_Field->save() around options saving.

Change History (3)

#2 @DJPaul
5 years ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to 2.3
  • Priority changed from normal to high

#3 @boonebgorges
4 years ago

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

In 9710:

Process is_default_option properly in xprofile_insert_field() and BP_XProfile_Field::save().

Previously, it was being ignored, which meant there was no way to change
is_default_option within the API.

Fixes #6137.

Note: See TracTickets for help on using tickets.