Changeset 4362
- Timestamp:
- 05/15/2011 05:23:50 PM (14 years ago)
- Location:
- trunk/bp-xprofile
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-filters.php
r4351 r4362 67 67 * @param string $field_value 68 68 * @param int $field_id 69 * @param bool $reserialize Whether to reserialize arrays before returning. Defaults to true 69 70 * @return string 70 71 */ 71 function xprofile_sanitize_data_value_before_save ( $field_value, $field_id ) {72 function xprofile_sanitize_data_value_before_save ( $field_value, $field_id, $reserialize = true ) { 72 73 73 74 // Return if empty … … 94 95 } 95 96 96 $filtered_field_value = serialize( $filtered_values ); 97 if ( $reserialize ) 98 $filtered_field_value = serialize( $filtered_values ); 99 else 100 $filtered_field_value = $filtered_values; 97 101 } 98 102 -
trunk/bp-xprofile/bp-xprofile-template.php
r4211 r4362 433 433 $selected = ''; 434 434 435 // Run the allowed option name through the before_save 436 // filter, so we'll be sure to get a match 437 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false ); 438 435 439 // First, check to see whether the user-entered value 436 440 // matches 437 if ( in_array( $ options[$k]->name, (array) $option_values ) )441 if ( in_array( $allowed_options, (array) $option_values ) ) 438 442 $selected = ' selected="selected"'; 439 443 … … 459 463 } 460 464 465 // Run the allowed option name through the before_save 466 // filter, so we'll be sure to get a match 467 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false ); 468 461 469 $selected = ''; 462 if ( $option_value == $ options[$k]->name || !empty( $value ) && $value == $options[$k]->name|| ( empty( $option_value ) && $options[$k]->is_default_option ) )470 if ( $option_value == $allowed_options || !empty( $value ) && $value == $allowed_options || ( empty( $option_value ) && $options[$k]->is_default_option ) ) 463 471 $selected = ' checked="checked"'; 464 472 … … 486 494 // match the option 487 495 for ( $j = 0; $j < count($option_values); $j++ ) { 488 if ( $option_values[$j] == $options[$k]->name || @in_array( $options[$k]->name, $value ) ) { 496 497 // Run the allowed option name through the 498 // before_save filter, so we'll be sure to get a 499 // match 500 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false ); 501 502 if ( $option_values[$j] == $allowed_options || @in_array( $allowed_options, $value ) ) { 489 503 $selected = ' checked="checked"'; 490 504 break;
Note: See TracChangeset
for help on using the changeset viewer.