BP_XProfile_Field::__construct( int|null $id = null, int|null $user_id = null, bool $get_data = true )

Initialize and/or populate profile field.

Description

Parameters

$id

(int|null) (Optional) Field ID.

Default value: null

$user_id

(int|null) (Optional) User ID.

Default value: null

$get_data

(bool) (Optional) Get data.

Default value: true

Source

File: bp-xprofile/classes/class-bp-xprofile-field.php

	public function __construct( $id = null, $user_id = null, $get_data = true ) {

		if ( ! empty( $id ) ) {
			$this->populate( $id, $user_id, $get_data );

			// Initialise the type obj to prevent fatals when creating new profile fields.
		} else {
			$this->type_obj            = bp_xprofile_create_field_type( 'textbox' );
			$this->type_obj->field_obj = $this;
		}
	}

Changelog

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