Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

#6134 closed defect (bug) (fixed)

"Default" setting doesnt work for checkboxes

Reported by: sooskriszta's profile sooskriszta Owned by: djpaul's profile 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
10 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
10 years ago

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

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

#3 @sooskriszta
10 years ago

  • Cc vivek@… added

#4 @DJPaul
10 years ago

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

#5 @DJPaul
10 years ago

Confirmed that this broke with the rewrite in 2.0.

#6 @DJPaul
10 years ago

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

Let's deal with this in #6137

#7 @djpaul
10 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.