BP_XProfile_Field::get_instance( int $field_id, int|null $user_id = null, bool $get_data = true )
Retrieve a BP_XProfile_Field instance.
Description
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
(BP_XProfile_Field|false) Field object if found, otherwise false.
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
| Version | Description |
|---|---|
| BuddyPress 2.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.