LLMS_Person_Handler::find_password_fields( string $location )

Locate password fields from a given form location.


Parameters Parameters

$location

(string) (Required) From location.


Top ↑

Return Return

(false|array[])


Top ↑

Source Source

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

	protected static function find_password_fields( $location ) {

		$forms = LLMS_Forms::instance();
		$all   = $forms->get_form_fields( $location );

		$pwd = $forms->get_field_by( (array) $all, 'id', 'password' );

		// If we don't have a password in the form return early.
		if ( ! $pwd ) {
			return false;
		}

		// Setup the return array.
		$fields = array( $pwd );

		// Add confirmation and strength meter if they exist.
		foreach ( array( 'password_confirm', 'llms-password-strength-meter' ) as $id ) {

			$field = $forms->get_field_by( $all, 'id', $id );
			if ( $field ) {

				// If we have a confirmation field ensure that the fields sit side by side.
				if ( 'password_confirm' === $id ) {

					$fields[0]['columns']         = 6;
					$fields[0]['last_column']     = false;
					$fields[0]['wrapper_classes'] = array();

					$field['columns']         = 6;
					$field['last_column']     = true;
					$field['wrapper_classes'] = array();

				}

				$fields[] = $field;
			}
		}

		return $fields;

	}


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.