diff --git src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php
index 736c66c..efcfdf3 100644
|
|
class BP_XProfile_Field_Type_Checkbox extends BP_XProfile_Field_Type { |
104 | 104 | public function edit_field_options_html( array $args = array() ) { |
105 | 105 | $options = $this->field_obj->get_children(); |
106 | 106 | $option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $this->field_obj->id, $args['user_id'] ) ); |
| 107 | |
| 108 | // Differentiate null values. |
| 109 | // If the user has specifically chosen none of the options, $option_value will be an empty array. |
| 110 | // If the user has no saved value for this field, $option_value will be an empty string. |
| 111 | $user_has_saved_value = true; |
| 112 | if ( empty( $option_values ) && ! is_array( $option_values ) ) { |
| 113 | $user_has_saved_value = false; |
| 114 | } |
107 | 115 | $option_values = ( $option_values ) ? (array) $option_values : array(); |
108 | 116 | |
109 | 117 | $html = ''; |
… |
… |
class BP_XProfile_Field_Type_Checkbox extends BP_XProfile_Field_Type { |
134 | 142 | |
135 | 143 | // If the user has not yet supplied a value for this field, check to |
136 | 144 | // see whether there is a default value available. |
137 | | if ( empty( $option_values ) && empty( $selected ) && ! empty( $options[$k]->is_default_option ) ) { |
| 145 | if ( ! $user_has_saved_value && empty( $selected ) && ! empty( $options[$k]->is_default_option ) ) { |
138 | 146 | $selected = ' checked="checked"'; |
139 | 147 | } |
140 | 148 | |