Changeset 3270
- Timestamp:
- 09/17/2010 06:07:07 PM (14 years ago)
- Location:
- branches/1.2/bp-xprofile
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-xprofile/bp-xprofile-classes.php
r3143 r3270 483 483 $input_types = array( 'checkbox', 'selectbox', 'multiselectbox', 'radio' ); 484 484 485 foreach ( $input_types as $type) {485 foreach ( $input_types as $type ) { 486 486 $default_name = ''; 487 487 488 if ( 'multiselectbox' == $type || 'checkbox' == $type ) {488 if ( 'multiselectbox' == $type || 'checkbox' == $type ) 489 489 $default_input = 'checkbox'; 490 } else { 491 $default_input = 'radio'; 492 } 493 ?> 490 else 491 $default_input = 'radio'; ?> 492 494 493 <div id="<?php echo $type ?>" class="options-box" style="<?php if ( $this->type != $type ) { ?>display: none;<?php } ?> margin-left: 15px;"> 495 494 <h4><?php _e('Please enter options for this Field:', 'buddypress') ?></h4> … … 520 519 } 521 520 522 if ( !empty( $options) ) {523 for ( $i = 0; $i < count( $options); $i++ ) {521 if ( !empty( $options ) ) { 522 for ( $i = 0; $i < count( $options ); $i++ ) { 524 523 $j = $i + 1; 525 524 526 525 if ( 'multiselectbox' == $type || 'checkbox' == $type ) 527 $default_name = '[' . $j . ']'; 528 ?> 529 <p><?php _e('Option', 'buddypress') ?> <?php echo $j ?>: 530 <input type="text" name="<?php echo $type ?>_option[<?php echo $j ?>]" id="<?php echo $type ?>_option<?php echo $j ?>" value="<?php echo esc_attr( $options[$i]->name ) ?>" /> 531 <input type="<?php echo $default_input ?>" name="isDefault_<?php echo $type ?>_option<?php echo $default_name ?>" <?php if ( (int) $options[$i]->is_default_option ) {?> checked="checked"<?php } ?> " value="<?php echo $j ?>" /> <?php _e( 'Default Value', 'buddypress' ) ?> 532 <?php if ( $j != 1 && 533 $options[$i]->id != -1 ) : ?><a href="admin.php?page=bp-profile-setup&mode=delete_option&option_id=<?php echo $options[$i]->id ?>" class="ajax-option-delete" id="delete-<?php echo $options[$i]->id ?>">[x]</a><?php endif ?></p> 526 $default_name = '[' . $j . ']'; ?> 527 528 <p> 529 <?php _e('Option', 'buddypress') ?> <?php echo $j ?>: 530 <input type="text" name="<?php echo $type ?>_option[<?php echo $j ?>]" id="<?php echo $type ?>_option<?php echo $j ?>" value="<?php echo esc_attr( $options[$i]->name ) ?>" /> 531 <input type="<?php echo $default_input ?>" name="isDefault_<?php echo $type ?>_option<?php echo $default_name ?>" <?php if ( (int) $options[$i]->is_default_option ) {?> checked="checked"<?php } ?> value="<?php echo $j ?>" /> <?php _e( 'Default Value', 'buddypress' ) ?> 532 533 <?php if ( $j != 1 && $options[$i]->id != -1 ) : ?> 534 535 <a href="admin.php?page=bp-profile-setup&mode=delete_option&option_id=<?php echo $options[$i]->id ?>" class="ajax-option-delete" id="delete-<?php echo $options[$i]->id ?>">[x]</a> 536 537 <?php endif ?> 538 534 539 </p> 540 535 541 <?php } // end for ?> 542 536 543 <input type="hidden" name="<?php echo $type ?>_option_number" id="<?php echo $type ?>_option_number" value="<?php echo $j + 1 ?>" /> 537 544 … … 539 546 } else { 540 547 if ( 'multiselectbox' == $type || 'checkbox' == $type ) 541 $default_name = '[1]'; 542 ?> 548 $default_name = '[1]'; ?> 543 549 544 550 <p><?php _e('Option', 'buddypress') ?> 1: <input type="text" name="<?php echo $type ?>_option[1]" id="<?php echo $type ?>_option1" /> … … 547 553 548 554 <?php } // end if ?> 555 549 556 <div id="<?php echo $type ?>_more"></div> 550 557 <p><a href="javascript:add_option('<?php echo $type ?>')"><?php _e('Add Another Option', 'buddypress') ?></a></p> … … 627 634 </p> 628 635 636 </div> 637 629 638 <div class="clear"></div> 630 639 … … 800 809 $user_ids = implode( ',', (array)$user_ids ); 801 810 $data = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id IN ({$user_ids})", $field_id ) ); 802 } else 811 } else { 803 812 $data = $wpdb->get_var( $wpdb->prepare( "SELECT value FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_ids ) ); 804 805 return $data; 813 } 814 815 return maybe_unserialize( $data ); 806 816 } 807 817 -
branches/1.2/bp-xprofile/bp-xprofile-templatetags.php
r3260 r3270 377 377 378 378 for ( $k = 0; $k < count($options); $k++ ) { 379 $option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ));379 $option_values = BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ); 380 380 $option_values = (array)$option_values; 381 381
Note: See TracChangeset
for help on using the changeset viewer.