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_Person_Handler::fill_fields( array $fields, array $data )

Field an array of user fields retrieved from self::get_available_fields() with data the resulting array will be the data retrieved from self::get_available_fields() with “value” keys filled for each field


Description Description


Parameters Parameters

$fields

(array) (Required) array of fields from self::get_available_fields()

$data

(array) (Required) array of data (from a $_POST or function)


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/class.llms.person.handler.php

	private static function fill_fields( $fields, $data ) {

		if ( is_numeric( $data ) ) {
			$user = new LLMS_Student( $data );
		}

		foreach ( $fields as &$field ) {

			if ( 'password' === $field['type'] || 'html' === $field['type'] ) {
				continue;
			}

			$name = isset( $field['name'] ) ? $field['name'] : $field['id'];
			$val = false;

			if ( isset( $data[ $name ] ) ) {

				$val = $data[ $name ];

			} elseif ( isset( $user ) ) {

				if ( 'email_address' === $name ) {
					$name = 'user_email';
				}
				$val = $user->get( $name );

			}

			if ( $val ) {
				if ( 'checkbox' === $field['type'] ) {
					if ( $val == $field['value'] ) {
						$field['selected'] = true;
					}
				} else {
					$field['value'] = $val;
				}
			}
		}

		return $fields;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: