- Timestamp:
- 01/06/2023 11:35:55 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-radiobutton.php
r13372 r13392 125 125 // Check for updated posted values, but errors preventing them from 126 126 // being saved first time. 127 if ( isset( $_POST[ 'field_' . $this->field_obj->id] ) && $option_value != $_POST['field_' . $this->field_obj->id] ) {128 if ( ! empty( $_POST[ 'field_' . $this->field_obj->id] ) ) {129 $option_value = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id] );127 if ( isset( $_POST[ 'field_' . $this->field_obj->id ] ) && $option_value != $_POST[ 'field_' . $this->field_obj->id ] ) { 128 if ( ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) { 129 $option_value = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id ] ); 130 130 } 131 131 } … … 133 133 // Run the allowed option name through the before_save filter, so 134 134 // we'll be sure to get a match. 135 $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k]->name, false, false );135 $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k ]->name, false, false ); 136 136 $selected = ''; 137 137 138 if ( $option_value === $allowed_options || ( empty( $option_value ) && ! empty( $options[ $k]->is_default_option ) ) ) {138 if ( $option_value === $allowed_options || ( empty( $option_value ) && ! empty( $options[ $k ]->is_default_option ) ) ) { 139 139 $selected = ' checked="checked"'; 140 140 } … … 144 144 esc_attr( bp_get_the_profile_field_input_name() ), 145 145 esc_attr( "option_{$options[$k]->id}" ), 146 esc_attr( stripslashes( $options[ $k]->name ) ),147 esc_html( stripslashes( $options[ $k]->name ) )146 esc_attr( stripslashes( $options[ $k ]->name ) ), 147 esc_html( stripslashes( $options[ $k ]->name ) ) 148 148 ); 149 149 … … 159 159 * @param string $k Current index in the foreach loop. 160 160 */ 161 $html .= apply_filters( 'bp_get_the_profile_field_options_radio', $new_html, $options[ $k], $this->field_obj->id, $selected, $k );161 $html .= apply_filters( 'bp_get_the_profile_field_options_radio', $new_html, $options[ $k ], $this->field_obj->id, $selected, $k ); 162 162 } 163 163
Note: See TracChangeset
for help on using the changeset viewer.