BP_REST_XProfile_Fields_Endpoint::get_xprofile_field_object( WP_REST_Request $request )

Get XProfile field object.

Description

Parameters

$request

(Required) Full details about the request.

Return

(BP_XProfile_Field|string) XProfile field object|string.

Source

File: bp-xprofile/classes/class-bp-rest-xprofile-fields-endpoint.php

	public function get_xprofile_field_object( $request ) {
		if ( is_numeric( $request ) ) {
			$field_id = $request;
			$user_id  = null;
		} else {
			$field_id = $request->get_param( 'id' );
			$user_id  = $request->get_param( 'user_id' );
		}

		$field = xprofile_get_field( $field_id, $user_id );

		if ( empty( $field ) ) {
			return '';
		}

		return $field;
	}

Changelog

Changelog
Version Description
0.1.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.