BP_XProfile_Field::get_instance( int $field_id, int|null $user_id = null, bool $get_data = true )
Retrieve a BP_XProfile_Field instance.
Description Description
Parameters Parameters
- $field_id
-
(Required) ID of the field.
- $user_id
-
(Optional) ID of the user associated with the field. Ignored if
$get_datais false. If$get_datais true, but no$user_idis provided, defaults to logged-in user ID.Default value: null
- $get_data
-
(Optional) Whether to fetch data for the specified
$user_id.Default value: true
Return Return
(BP_XProfile_Field|false) Field object if found, otherwise false.
Source Source
File: bp-xprofile/classes/class-bp-xprofile-field.php
public static function get_instance( $field_id, $user_id = null, $get_data = true ) {
global $wpdb;
$field_id = (int) $field_id;
if ( ! $field_id ) {
return false;
}
return new self( $field_id, $user_id, $get_data );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.8.0 | Added $user_id and $get_data parameters. |
| 2.4.0 | Introduced. |