Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Form_Field::define_data_source( int|object $data_source )

Define the source of the data


Parameters Parameters

$data_source

(int|object) (Required) Data source where to get field value from.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/forms/class-llms-form-field.php

	private function define_data_source( $data_source ) {

		if ( empty( $this->settings['data_store'] ) || ! in_array( $this->settings['data_store'], array( 'users', 'usermeta' ), true ) ) {
			return;
		}

		if ( ! is_null( $data_source ) ) {
			$data_source = $data_source instanceof WP_User ? $data_source : get_user_by( 'ID', $data_source );
		} elseif ( is_user_logged_in() ) {
			$data_source = wp_get_current_user();
		}

		if ( $data_source instanceof WP_User ) {
			$this->data_source      = $data_source;
			$this->data_source_type = 'wp_user';
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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