diff --git src/bp-xprofile/bp-xprofile-functions.php src/bp-xprofile/bp-xprofile-functions.php
index 716c335..587dc79 100644
|
|
function xprofile_insert_field( $args = '' ) { |
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 ) { |
diff --git src/bp-xprofile/classes/class-bp-xprofile-field.php src/bp-xprofile/classes/class-bp-xprofile-field.php
index bb75f29..16cf3e6 100644
|
|
class BP_XProfile_Field { |
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; |
… |
… |
class BP_XProfile_Field { |
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 | /** |
diff --git src/bp-xprofile/classes/class-bp-xprofile-group.php src/bp-xprofile/classes/class-bp-xprofile-group.php
index a3934a5..aca4c32 100644
|
|
class BP_XProfile_Group { |
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. |
… |
… |
class BP_XProfile_Group { |
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; |
diff --git src/bp-xprofile/classes/class-bp-xprofile-profiledata.php src/bp-xprofile/classes/class-bp-xprofile-profiledata.php
index 8dc10f9..d0b1b7b 100644
|
|
class BP_XProfile_ProfileData { |
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 | } |