Changeset 10561
- Timestamp:
- 02/08/2016 05:09:08 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php
r10417 r10561 106 106 $options = $this->field_obj->get_children(); 107 107 $option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $this->field_obj->id, $args['user_id'] ) ); 108 109 /* 110 * Determine whether to pre-select the default option. 111 * 112 * If there's no saved value, take the following into account: 113 * If the user has never saved a value for this field, 114 * $option_values will be an empty string, and we should pre-select the default option. 115 * If the user has specifically chosen none of the options, 116 * $option_values will be an empty array, and we should respect that value. 117 */ 118 $select_default_option = false; 119 if ( empty( $option_values ) && ! is_array( $option_values ) ) { 120 $select_default_option = true; 121 } 122 108 123 $option_values = ( $option_values ) ? (array) $option_values : array(); 109 124 … … 136 151 // If the user has not yet supplied a value for this field, check to 137 152 // see whether there is a default value available. 138 if ( empty( $ option_values ) && empty( $selected )&& ! empty( $options[$k]->is_default_option ) ) {153 if ( empty( $selected ) && $select_default_option && ! empty( $options[$k]->is_default_option ) ) { 139 154 $selected = ' checked="checked"'; 140 155 }
Note: See TracChangeset
for help on using the changeset viewer.