Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/21/2015 02:27:49 PM (12 years ago)
Author:
djpaul
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php

    r9486 r9521  
    117117                }
    118118
    119                 $option_values = (array) $original_option_values;
     119                $option_values = ( $original_option_values ) ? (array) $original_option_values : array();
    120120                for ( $k = 0, $count = count( $options ); $k < $count; ++$k ) {
    121121                        $selected = '';
Note: See TracChangeset for help on using the changeset viewer.