Changeset 4431
- Timestamp:
- 05/28/2011 06:01:48 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-template.php
r4372 r4431 419 419 $html .= '<option value="">--------</option>'; 420 420 421 for ( $k = 0; $k < count($options); $k++ ) {422 $original_option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ) );423 $option_values = (array) $original_option_values; 424 421 $original_option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field->id ) ); 422 $option_values = (array) $original_option_values; 423 424 for ( $k = 0; $k < count( $options ); $k++ ) { 425 425 // Check for updated posted values, but errors preventing them from being saved first time 426 426 foreach( $option_values as $i => $option_value ) { … … 432 432 433 433 $selected = ''; 434 434 435 435 // Run the allowed option name through the before_save 436 436 // filter, so we'll be sure to get a match 437 437 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false ); 438 438 439 439 // First, check to see whether the user-entered value 440 440 // matches … … 453 453 case 'radio': 454 454 $html .= '<div id="field_' . $field->id . '">'; 455 456 for ( $k = 0; $k < count($options); $k++ ) { 457 $option_value = BP_XProfile_ProfileData::get_value_byid($options[$k]->parent_id); 458 455 $option_value = BP_XProfile_ProfileData::get_value_byid( $field->id ); 456 457 for ( $k = 0; $k < count( $options ); $k++ ) { 459 458 // Check for updated posted values, but errors preventing them from being saved first time 460 459 if ( isset( $_POST['field_' . $field->id] ) && $option_value != $_POST['field_' . $field->id] ) { … … 462 461 $option_value = $_POST['field_' . $field->id]; 463 462 } 464 463 465 464 // Run the allowed option name through the before_save 466 465 // filter, so we'll be sure to get a match 467 466 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false ); 468 469 $selected = ''; 467 468 $selected = ''; 470 469 if ( $option_value == $allowed_options || !empty( $value ) && $value == $allowed_options || ( empty( $option_value ) && $options[$k]->is_default_option ) ) 471 470 $selected = ' checked="checked"'; … … 478 477 479 478 case 'checkbox': 480 $option_values = BP_XProfile_ProfileData::get_value_byid($options[0]->parent_id); 479 $option_values = BP_XProfile_ProfileData::get_value_byid( $field->id ); 480 $option_values = maybe_unserialize( $option_values ); 481 481 482 482 // Check for updated posted values, but errors preventing them from being saved first time … … 486 486 } 487 487 488 $option_values = maybe_unserialize($option_values); 489 490 for ( $k = 0; $k < count($options); $k++ ) { 488 for ( $k = 0; $k < count( $options ); $k++ ) { 491 489 $selected = ''; 492 490 493 491 // First, check to see whether the user's saved values 494 492 // match the option 495 for ( $j = 0; $j < count( $option_values); $j++ ) {496 493 for ( $j = 0; $j < count( $option_values ); $j++ ) { 494 497 495 // Run the allowed option name through the 498 496 // before_save filter, so we'll be sure to get a 499 497 // match 500 498 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false ); 501 499 502 500 if ( $option_values[$j] == $allowed_options || @in_array( $allowed_options, $value ) ) { 503 501 $selected = ' checked="checked"'; … … 505 503 } 506 504 } 507 505 508 506 // If the user has not yet supplied a value for this field, 509 507 // check to see whether there is a default value available
Note: See TracChangeset
for help on using the changeset viewer.