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_data is false. If $get_data is true, but no $user_id is 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


Top ↑

Return Return

(BP_XProfile_Field|false) Field object if found, otherwise false.


Top ↑

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 );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Added $user_id and $get_data parameters.
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.