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

Initialize and/or populate profile field.


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

		// Initialize 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;
		}

		/**
		 * Fires when the xProfile field object has been constructed.
		 *
		 * @since 8.0.0
		 *
		 * @param BP_XProfile_Field $this The xProfile field object.
		 */
		do_action( 'bp_xprofile_field', $this );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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