Changeset 9324
- Timestamp:
- 01/09/2015 05:48:38 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-classes.php
r9315 r9324 938 938 return false; 939 939 940 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s ", $field_name ) );940 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s AND parent_id = 0", $field_name ) ); 941 941 } 942 942 -
trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-field.php
r8958 r9324 27 27 $this->assertEquals( '0', $f2->can_delete ); 28 28 } 29 30 /** 31 * @group xprofile_get_field_id_from_name 32 */ 33 public function test_get_id_from_name_field_name_option_value_conflict() { 34 $group = $this->factory->xprofile_group->create(); 35 36 // force some checkbox options for our profile field 37 $_POST['checkbox_option'] = array( 38 1 => 'BuddyPress', 39 2 => 'WordPress' 40 ); 41 42 // checkbox field 43 $f1 = $this->factory->xprofile_field->create( array( 44 'field_group_id' => $group, 45 'type' => 'checkbox', 46 'name' => 'Interests' 47 ) ); 48 49 // textbox field with the same name as our checkbox value 50 $f2 = $this->factory->xprofile_field->create( array( 51 'field_group_id' => $group, 52 'type' => 'textbox', 53 'name' => 'BuddyPress' 54 ) ); 55 56 $this->assertEquals( $f2, xprofile_get_field_id_from_name( 'BuddyPress' ) ); 57 58 // cleanup! 59 unset( $_POST['checkbox_option'] ); 60 } 29 61 }
Note: See TracChangeset
for help on using the changeset viewer.