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
Description Description
The resulting array will be the data retrieved from self::get_available_fields() with "value" keys filled for each field.
Parameters Parameters
- $fields
-
(array) (Required) Array of fields from self::get_available_fields().
- $data
-
(array) (Required) Array of data (from a $_POST or function).
Return Return
(array)
Source Source
File: includes/class.llms.person.handler.php
$name = isset( $field['name'] ) ? $field['name'] : $field['id']; $label = isset( $field['label'] ) ? $field['label'] : $name; $field_type = isset( $field['type'] ) ? $field['type'] : ''; $val = isset( $data[ $name ] ) ? $data[ $name ] : ''; // Ensure required fields are submitted. if ( ! empty( $field['required'] ) && empty( $val ) ) { $err->add( $field['id'], sprintf( __( '%s is a required field', 'lifterlms' ), $label ), 'required' ); continue; } // Email fields must be emails. if ( 'email' === $field_type && ! is_email( $val ) ) { $err->add( $field['id'], sprintf( __( '%s must be a valid email address', 'lifterlms' ), $label ), 'invalid' ); } } $valid = $err->has_errors() ? $err : true; /** * Filters the validation result of user-submitted login data * * @since 4.21.0 * * @param WP_Error|boolean $valid An error object containing validation errors or `true` if no validation errors found. * @param array $data User submitted login data. */ return apply_filters( 'llms_after_user_login_data_validation', $valid, $data ); } /** * Retrieve an array of fields for a specific screen * * @since 3.0.0 * @since 3.7.0 Unknown. * @deprecated 5.0.0 `LLMS_Person_Handler::get_available_fields()` is deprecated in favor of `LLMS_Forms::get_form_fields()`. * * @param string $screen Name os the screen [account|checkout|registration].
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.35.0 | Sanitize field data when filling field with user-submitted data. |
3.0.0 | Introduced. |