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::get_password_fields( string $screen = 'registration', array $fields = array() )

Retrieve an array of password fields for a specific screen


Description Description

Each array represents a form field that can be passed to llms_form_field()


Parameters Parameters

$screen

(string) (Optional) name os the screen [account|checkout|registration]

Default value: 'registration'

$fields

(array) (Optional) array of fields to add the pass fields to (from self::get_available_fields() for example)

Default value: array()


Top ↑

Return Return

(array)


Top ↑

Source Source

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

	private static function get_password_fields( $screen = 'registration', $fields = array() ) {

		if ( 'account' === $screen ) {
			$fields[] = array(
				'columns' => 12,
				'id' => 'current_password',
				'label' => __( 'Current Password', 'lifterlms' ),
				'last_column' => true,
				'required' => true,
				'type'  => 'password',
				'wrapper_classes' => 'llms-change-password',
			);
		}

		$fields[] = array(
			'columns' => 6,
			'classes' => 'llms-password',
			'id' => 'password',
			'label' => ( 'account' === $screen ) ? __( 'New Password', 'lifterlms' ) : __( 'Password', 'lifterlms' ),
			'last_column' => false,
			'matched' => 'password_confirm',
			'required' => true,
			'type'  => 'password',
			'wrapper_classes' => ( 'account' === $screen ) ? 'llms-change-password' : '',
		);
		$fields[] = array(
			'columns' => 6,
			'classes' => 'llms-password-confirm',
			'id' => 'password_confirm',
			'label' => ( 'account' === $screen ) ? __( 'Confirm New Password', 'lifterlms' ) : __( 'Confirm Password', 'lifterlms' ),
			'last_column' => true,
			'match' => 'password',
			'required' => true,
			'type'  => 'password',
			'wrapper_classes' => ( 'account' === $screen ) ? 'llms-change-password' : '',
		);

		if ( 'yes' === get_option( 'lifterlms_registration_password_strength' ) ) {
			$strength = llms_get_minimum_password_strength();
			if ( 'strong' === $strength ) {
				$desc = __( 'A %s password is required.', 'lifterlms' );
			} else {
				$desc = __( 'A minimum password strength of %s is required.', 'lifterlms' );
			}

			$fields[] = array(
				'columns' => 12,
				'classes' => 'llms-password-strength-meter',
				'description' => sprintf( $desc, llms_get_minimum_password_strength_name() ) . ' ' . __( 'The password must be at least 6 characters in length. Consider adding letters, numbers, and symbols to increase the password strength.', 'lifterlms' ),
				'id' => 'llms-password-strength-meter',
				'last_column' => true,
				'type'  => 'html',
				'wrapper_classes' => ( 'account' === $screen ) ? 'llms-change-password' : '',
			);
		}

		if ( 'account' === $screen ) {

			$fields[] = array(
				'columns' => 12,
				'classes' => 'llms-password-change-toggle',
				'value' => '<a data-action="show" data-text="' . __( 'Cancel', 'lifterlms' ) . '" href="#llms-password-change-toggle">' . __( 'Change Password', 'lifterlms' ) . '</a>',
				'id' => 'llms-password-change-toggle',
				'last_column' => true,
				'type'  => 'html',
			);

		}

		return $fields;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.7.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: