Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

#6134 closed defect (bug) (fixed)

"Default" setting doesnt work for checkboxes

Reported by: sooskriszta Owned by: djpaul
Milestone: 2.3 Priority: high
Severity: normal Version: 2.0
Component: Extended Profile Keywords:
Cc: vivek@…

Description

Expected behavior: If in field setting, an option is marked as default, then it should be checked by default in frontend.

Actual behavior: Checkboxes are never checked by default.

Change History (7)

#1 @DJPaul
5 years ago

  • Version set to 2.0

Defaults that work:

  • Radio buttons

Default that are broken:

  • Checkboxes
  • Multi select box
  • Dropdown select box

Tested on trunk. I am going to guess these have been broken since 2.0 but we need to test on 2.1 to see if this is a regression -- if it isn't, we'll probably consider fixing for 2.3.

#2 @slaFFik
5 years ago

Some more info here #6137
But radios using xprofile_insert_field() don't work as well.

Last edited 5 years ago by slaFFik (previous) (diff)

#3 @sooskriszta
5 years ago

  • Cc vivek@… added

#4 @DJPaul
5 years ago

  • Milestone changed from Awaiting Review to 2.3
  • Priority changed from normal to high

#5 @DJPaul
5 years ago

Confirmed that this broke with the rewrite in 2.0.

#6 @DJPaul
5 years ago

But radios using xprofile_insert_field() don't work as well.

Let's deal with this in #6137

#7 @djpaul
5 years ago

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

In 9521:

xprofile: fix broken selection of default values for checkboxes, select boxes, and multi-select boxes.

When we try to fetch a user's profile field value from the database, if it wasn't set, then we return an empty string.
A few profile field types were mishandling an empty string response from BP_XProfile_ProfileData::get_value_byid, and it was being mistakenly interpreted as a user selected value.

This change checks the return value from BP_XProfile_ProfileData::get_value_byid, and if it's empty, instead of always casting the value, sets the ongoing variable to an empty array instead.

Fixes #6134

Note: See TracTickets for help on using tickets.