Ticket #7401: 7401.3.diff
File 7401.3.diff, 3.2 KB (added by , 8 years ago) |
---|
-
src/bp-xprofile/bp-xprofile-functions.php
286 286 * @param int|object $field ID of the field or object representing field data. 287 287 * @return BP_XProfile_Field|null Field object if found, otherwise null. 288 288 */ 289 function xprofile_get_field( $field ) {289 function xprofile_get_field( $field, $user_id = null, $get_data = true ) { 290 290 if ( $field instanceof BP_XProfile_Field ) { 291 291 $_field = $field; 292 292 } elseif ( is_object( $field ) ) { … … 293 293 $_field = new BP_XProfile_Field(); 294 294 $_field->fill_data( $field ); 295 295 } else { 296 $_field = BP_XProfile_Field::get_instance( $field );296 $_field = BP_XProfile_Field::get_instance( $field, $user_id, $get_data ); 297 297 } 298 298 299 299 if ( ! $_field ) { -
src/bp-xprofile/classes/class-bp-xprofile-field.php
233 233 * @param int $field_id ID of the field. 234 234 * @return BP_XProfile_Field|false Field object if found, otherwise false. 235 235 */ 236 public static function get_instance( $field_id ) {236 public static function get_instance( $field_id, $user_id = null, $get_data = true ) { 237 237 global $wpdb; 238 238 239 239 $field_id = (int) $field_id; … … 241 241 return false; 242 242 } 243 243 244 return new self( $field_id );244 return new self( $field_id, $user_id, $get_data ); 245 245 } 246 246 247 247 /** -
src/bp-xprofile/classes/class-bp-xprofile-group.php
396 396 // Pull field objects from the cache. 397 397 $fields = array(); 398 398 foreach ( $field_ids as $field_id ) { 399 $fields[] = xprofile_get_field( $field_id );399 $fields[] = xprofile_get_field( $field_id, null, false ); 400 400 } 401 401 402 402 // Store field IDs for meta cache priming. … … 446 446 447 447 // Loop through the data in each field. 448 448 foreach( (array) $field_data as $data ) { 449 450 449 // Assign correct data value to the field. 451 450 if ( $field->id == $data->field_id ) { 452 451 $fields[ $field_key ]->data = new stdClass; -
src/bp-xprofile/classes/class-bp-xprofile-profiledata.php
323 323 } else { 324 324 $d = new stdClass; 325 325 $d->id = ''; 326 $d->user_id = '';326 $d->user_id = $user_id; 327 327 $d->field_id = $field_id; 328 328 $d->value = ''; 329 329 $d->last_updated = ''; … … 489 489 $d = new stdClass; 490 490 $d->id = ''; 491 491 $d->user_id = $id; 492 $d->field_id = '';492 $d->field_id = $field_id; 493 493 $d->value = ''; 494 494 $d->last_updated = ''; 495 495 }