- 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-selectbox.php
r13372 r13392 107 107 $html = '<option value="">' . /* translators: no option picked in select box */ esc_html__( '----', 'buddypress' ) . '</option>'; 108 108 109 if ( empty( $original_option_values ) && !empty( $_POST[ 'field_' . $this->field_obj->id] ) ) {110 $original_option_values = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id] );109 if ( empty( $original_option_values ) && !empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) { 110 $original_option_values = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id ] ); 111 111 } 112 112 … … 118 118 // being saved first time. 119 119 foreach( $option_values as $i => $option_value ) { 120 if ( isset( $_POST[ 'field_' . $this->field_obj->id] ) && $_POST['field_' . $this->field_obj->id] != $option_value ) {121 if ( ! empty( $_POST[ 'field_' . $this->field_obj->id] ) ) {122 $option_values[ $i] = sanitize_text_field( $_POST['field_' . $this->field_obj->id] );120 if ( isset( $_POST[ 'field_' . $this->field_obj->id ] ) && $_POST[ 'field_' . $this->field_obj->id ] != $option_value ) { 121 if ( ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) { 122 $option_values[ $i ] = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id ] ); 123 123 } 124 124 } … … 127 127 // Run the allowed option name through the before_save filter, so 128 128 // we'll be sure to get a match. 129 $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k]->name, false, false );129 $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k ]->name, false, false ); 130 130 131 131 // First, check to see whether the user-entered value matches. … … 135 135 136 136 // Then, if the user has not provided a value, check for defaults. 137 if ( ! is_array( $original_option_values ) && empty( $option_values ) && $options[ $k]->is_default_option ) {137 if ( ! is_array( $original_option_values ) && empty( $option_values ) && $options[ $k ]->is_default_option ) { 138 138 $selected = ' selected="selected"'; 139 139 } … … 150 150 * @param string $k Current index in the foreach loop. 151 151 */ 152 $html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[ $k]->name ) ) . '">' . esc_html( stripslashes( $options[$k]->name ) ) . '</option>', $options[$k], $this->field_obj->id, $selected, $k );152 $html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[ $k ]->name ) ) . '">' . esc_html( stripslashes( $options[ $k ]->name ) ) . '</option>', $options[ $k ], $this->field_obj->id, $selected, $k ); 153 153 } 154 154
Note: See TracChangeset
for help on using the changeset viewer.