Changeset 8535
- Timestamp:
- 06/16/2014 07:30:37 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-classes.php
r8524 r8535 636 636 $this->order_by = apply_filters( 'xprofile_field_order_by_before_save', $this->order_by, $this->id ); 637 637 $this->field_order = apply_filters( 'xprofile_field_field_order_before_save', $this->field_order, $this->id ); 638 $this->option_order = apply_filters( 'xprofile_field_option_order_before_save', $this->option_order, $this->id ); 638 639 $this->can_delete = apply_filters( 'xprofile_field_can_delete_before_save', $this->can_delete, $this->id ); 639 640 $this->type_obj = bp_xprofile_create_field_type( $this->type ); … … 642 643 643 644 if ( $this->id != null ) { 644 $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d, can_delete = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->can_delete, $this->id );645 $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d, option_order = %d, can_delete = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->option_order, $this->can_delete, $this->id ); 645 646 } else { 646 $sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order, can_delete ) VALUES (%d, %d, %s, %s, %s, %d, %s, %d, %d )", $this->group_id, $this->parent_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->can_delete );647 $sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order, option_order, can_delete ) VALUES (%d, %d, %s, %s, %s, %d, %s, %d, %d, %d )", $this->group_id, $this->parent_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->option_order, $this->can_delete ); 647 648 } 648 649 -
trunk/tests/phpunit/testcases/xprofile/functions.php
r8518 r8535 591 591 $this->assertNotEmpty( $f ); 592 592 } 593 594 /** 595 * @group xprofile_insert_field 596 */ 597 public function test_xprofile_insert_field_type_option_option_order() { 598 $g = $this->factory->xprofile_group->create(); 599 $parent = $this->factory->xprofile_field->create( array( 600 'field_group_id' => $g, 601 'type' => 'selectbox', 602 'name' => 'Parent', 603 ) ); 604 605 $f = xprofile_insert_field( array( 606 'field_group_id' => $g, 607 'parent_id' => $parent, 608 'type' => 'option', 609 'name' => 'Option 1', 610 'option_order' => 5, 611 ) ); 612 613 $field = new BP_XProfile_Field( $f ); 614 615 $this->assertEquals( 5, $field->option_order ); 616 } 593 617 }
Note: See TracChangeset
for help on using the changeset viewer.