- Timestamp:
- 01/06/2023 11:35:55 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php
r13372 r13392 127 127 // Check for updated posted values, but errors preventing them from 128 128 // being saved first time. 129 if ( isset( $_POST[ 'field_' . $this->field_obj->id] ) && $option_values != maybe_serialize( $_POST['field_' . $this->field_obj->id] ) ) {130 if ( ! empty( $_POST[ 'field_' . $this->field_obj->id] ) ) {131 $option_values = array_map( 'sanitize_text_field', $_POST[ 'field_' . $this->field_obj->id] );129 if ( isset( $_POST[ 'field_' . $this->field_obj->id ] ) && $option_values != maybe_serialize( $_POST[ 'field_' . $this->field_obj->id ] ) ) { 130 if ( ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) { 131 $option_values = array_map( 'sanitize_text_field', $_POST[ 'field_' . $this->field_obj->id ] ); 132 132 } 133 133 } … … 141 141 // Run the allowed option name through the before_save filter, 142 142 // so we'll be sure to get a match. 143 $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k]->name, false, false );144 145 if ( $option_values[ $j] === $allowed_options || in_array( $allowed_options, $option_values ) ) {143 $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k ]->name, false, false ); 144 145 if ( $option_values[ $j ] === $allowed_options || in_array( $allowed_options, $option_values ) ) { 146 146 $selected = ' checked="checked"'; 147 147 break; … … 151 151 // If the user has not yet supplied a value for this field, check to 152 152 // see whether there is a default value available. 153 if ( empty( $selected ) && $select_default_option && ! empty( $options[ $k]->is_default_option ) ) {153 if ( empty( $selected ) && $select_default_option && ! empty( $options[ $k ]->is_default_option ) ) { 154 154 $selected = ' checked="checked"'; 155 155 } … … 159 159 esc_attr( bp_get_the_profile_field_input_name() . '[]' ), 160 160 esc_attr( "field_{$options[$k]->id}_{$k}" ), 161 esc_attr( stripslashes( $options[ $k]->name ) ),162 esc_html( stripslashes( $options[ $k]->name ) )161 esc_attr( stripslashes( $options[ $k ]->name ) ), 162 esc_html( stripslashes( $options[ $k ]->name ) ) 163 163 ); 164 164 … … 174 174 * @param string $k Current index in the foreach loop. 175 175 */ 176 $html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', $new_html, $options[ $k], $this->field_obj->id, $selected, $k );176 $html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', $new_html, $options[ $k ], $this->field_obj->id, $selected, $k ); 177 177 } 178 178
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)