Changeset 9675
- Timestamp:
- 04/01/2015 10:29:02 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php
r9674 r9675 144 144 } 145 145 146 if ( false === $result ) 146 if ( false === $result ) { 147 147 return false; 148 } 148 149 149 150 /** … … 182 183 do_action_ref_array( 'xprofile_data_before_delete', array( $this ) ); 183 184 184 if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $this->field_id, $this->user_id ) ) ) 185 $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $this->field_id, $this->user_id ) ); 186 if ( empty( $deleted ) ) { 185 187 return false; 188 } 186 189 187 190 /** … … 423 426 global $wpdb; 424 427 425 if ( empty( $fields ) ) 428 if ( empty( $fields ) ) { 426 429 return false; 427 428 $bp = buddypress(); 429 430 if ( empty( $user_id ) ) 430 } 431 432 $bp = buddypress(); 433 434 if ( empty( $user_id ) ) { 431 435 $user_id = bp_displayed_user_id(); 436 } 432 437 433 438 $field_sql = ''; … … 447 452 } 448 453 449 $sql = $wpdb->prepare( "SELECT d.value, f.name FROM {$bp->profile->table_name_data} d, {$bp->profile->table_name_fields} f WHERE d.field_id = f.id AND d.user_id = %d AND f.parent_id = 0 $field_sql", $user_id ); 450 451 if ( !$values = $wpdb->get_results( $sql ) ) 454 $sql = $wpdb->prepare( "SELECT d.value, f.name FROM {$bp->profile->table_name_data} d, {$bp->profile->table_name_fields} f WHERE d.field_id = f.id AND d.user_id = %d AND f.parent_id = 0 $field_sql", $user_id ); 455 $values = $wpdb->get_results( $sql ); 456 457 if ( empty( $values ) || is_wp_error( $values ) ) { 452 458 return false; 459 } 453 460 454 461 $new_values = array(); … … 474 481 global $wpdb; 475 482 476 $bp = buddypress();477 478 if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d", $field_id ) ) )483 $bp = buddypress(); 484 $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d", $field_id ) ); 485 if ( empty( $deleted ) || is_wp_error( $deleted ) ) { 479 486 return false; 487 } 480 488 481 489 return true; … … 512 520 public static function get_fullname( $user_id = 0 ) { 513 521 514 if ( empty( $user_id ) ) 522 if ( empty( $user_id ) ) { 515 523 $user_id = bp_displayed_user_id(); 516 517 $data = xprofile_get_field_data( bp_xprofile_fullname_field_id(), $user_id ); 518 519 return $data[$field_name]; 524 } 525 526 return xprofile_get_field_data( bp_xprofile_fullname_field_id(), $user_id ); 520 527 } 521 528 }
Note: See TracChangeset
for help on using the changeset viewer.