Changeset 4831
- Timestamp:
- 07/24/2011 01:17:12 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-themes/bp-default/forums/index.php
r4676 r4831 112 112 <select id="topic_group_id" name="topic_group_id"> 113 113 114 <option value=""> ----</option>114 <option value=""><?php /* translators: no option picked in select box */ _e( '----', 'buddypress' ); ?></option> 115 115 116 116 <?php while ( bp_groups() ) : bp_the_group(); ?> -
trunk/bp-xprofile/bp-xprofile-template.php
r4827 r4831 326 326 * value as long as it's not empty and a required field. 327 327 */ 328 if ( isset( $_POST['field_' . $field->id] ) && isset( $field->data->value ) && $field->data->value != $_POST['field_' . $field->id] ) { 328 if ( !isset( $field->data->value ) ) 329 $field->data->value = ''; 330 331 if ( isset( $_POST['field_' . $field->id] ) && $field->data->value != $_POST['field_' . $field->id] ) { 329 332 if ( !empty( $_POST['field_' . $field->id] ) ) 330 333 $field->data->value = $_POST['field_' . $field->id]; 334 else 335 $field->data->value = ''; 331 336 } 332 337 … … 417 422 418 423 switch ( $field->type ) { 419 420 case 'selectbox': case 'multiselectbox':421 if ( 'multiselectbox' != $field->type )422 $html .= '<option value="">--------</option>'; 423 424 case 'selectbox': 425 if ( !$field->is_required ) 426 $html .= '<option value="">' . /* translators: no option picked in select box */ __( '----', 'buddypress' ) . '</option>'; 427 428 $original_option_values = ''; 424 429 $original_option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field->id ) ); 430 431 if ( empty( $original_option_values ) && !empty( $_POST['field_' . $field->id] ) ) 432 $original_option_values = $_POST['field_' . $field->id]; 433 425 434 $option_values = (array) $original_option_values; 426 435 427 for ( $k = 0 ; $k < count( $options ); $k++) {436 for ( $k = 0, $count = count( $options ); $k < $count; ++$k ) { 428 437 // Check for updated posted values, but errors preventing them from being saved first time 429 438 foreach( $option_values as $i => $option_value ) { … … 433 442 } 434 443 } 435 436 444 $selected = ''; 437 445 438 // Run the allowed option name through the before_save 439 // filter, so we'll be sure to get a match 446 // Run the allowed option name through the before_save filter, so we'll be sure to get a match 440 447 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false ); 441 448 442 // First, check to see whether the user-entered value 443 // matches 449 // First, check to see whether the user-entered value matches 444 450 if ( in_array( $allowed_options, (array) $option_values ) ) 445 451 $selected = ' selected="selected"'; 446 452 447 // Then, if the user has not provided a value, check for 448 // defaults 449 if ( !is_array( $original_option_values ) && empty( $option_values ) & $options[$k]->is_default_option ) 453 // Then, if the user has not provided a value, check for defaults 454 if ( !is_array( $original_option_values ) && empty( $option_values ) && $options[$k]->is_default_option ) 450 455 $selected = ' selected="selected"'; 451 456 452 457 $html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[$k]->name ) ) . '">' . esc_attr( stripslashes( $options[$k]->name ) ) . '</option>', $options[$k] ); 458 } 459 break; 460 461 case 'multiselectbox': 462 $original_option_values = ''; 463 $original_option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field->id ) ); 464 465 if ( empty( $original_option_values ) && !empty( $_POST['field_' . $field->id] ) ) 466 $original_option_values = $_POST['field_' . $field->id]; 467 468 $option_values = (array) $original_option_values; 469 470 for ( $k = 0, $count = count( $options ); $k < $count; ++$k ) { 471 // Check for updated posted values, but errors preventing them from being saved first time 472 foreach( $option_values as $i => $option_value ) { 473 if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id][$i] != $option_value ) { 474 if ( !empty( $_POST['field_' . $field->id][$i] ) ) 475 $option_values[] = $_POST['field_' . $field->id][$i]; 476 } 477 } 478 $selected = ''; 479 480 // Run the allowed option name through the before_save filter, so we'll be sure to get a match 481 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false ); 482 483 // First, check to see whether the user-entered value matches 484 if ( in_array( $allowed_options, (array) $option_values ) ) 485 $selected = ' selected="selected"'; 486 487 // Then, if the user has not provided a value, check for defaults 488 if ( !is_array( $original_option_values ) && empty( $option_values ) && $options[$k]->is_default_option ) 489 $selected = ' selected="selected"'; 490 491 $html .= apply_filters( 'bp_get_the_profile_field_options_multiselect', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[$k]->name ) ) . '">' . esc_attr( stripslashes( $options[$k]->name ) ) . '</option>', $options[$k] ); 453 492 } 454 493 break; … … 458 497 $option_value = BP_XProfile_ProfileData::get_value_byid( $field->id ); 459 498 460 for ( $k = 0 ; $k < count( $options ); $k++) {499 for ( $k = 0, $count = count( $options ); $k < $count; ++$k ) { 461 500 // Check for updated posted values, but errors preventing them from being saved first time 462 501 if ( isset( $_POST['field_' . $field->id] ) && $option_value != $_POST['field_' . $field->id] ) { … … 489 528 } 490 529 491 for ( $k = 0 ; $k < count( $options ); $k++) {530 for ( $k = 0, $count = count( $options ); $k < $count; ++$k ) { 492 531 $selected = ''; 493 532 494 533 // First, check to see whether the user's saved values 495 534 // match the option 496 for ( $j = 0 ; $j < count( $option_values ); $j++) {535 for ( $j = 0, $count = count( $option_values ); $j < $count; ++$j ) { 497 536 498 537 // Run the allowed option name through the 499 // before_save filter, so we'll be sure to get a 500 // match 538 // before_save filter, so we'll be sure to get a match 501 539 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false ); 502 540
Note: See TracChangeset
for help on using the changeset viewer.