LLMS_Person_Handler::get_password_reset_fields( string $key = '', string $login = '' )

Retrieve form fields used on the password reset form.


Description Description

This method will attempt to the "custom" password fields in the checkout form and then in the registration form. At least a password field must be found. If it cannot be found this function falls back to a set of default fields as defined in the LLMS_Person_Handler::get_password_fields() method.


Top ↑

Parameters Parameters

$key

(string) (Optional) User password reset key, usually populated via $_GET vars.

Default value: ''

$login

(string) (Optional) User login (username), usually populated via $_GET vars.

Default value: ''


Top ↑

Return Return

(array[])


Top ↑

Source Source

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

	public static function get_password_reset_fields( $key = '', $login = '' ) {

		$fields = array();
		foreach ( array( 'checkout', 'registration' ) as $location ) {
			$fields = self::find_password_fields( $location );
			if ( $fields ) {
				break;
			}
		}

		// Fallback if no custom fields are found.
		if ( ! $fields ) {
			$location = 'fallback';
			$fields   = self::get_password_fields();
		}

		// Add button.
		$fields[] = array(
			'classes' => 'llms-button-action auto',
			'id'      => 'llms_lost_password_button',
			'type'    => 'submit',
			'value'   => __( 'Reset Password', 'lifterlms' ),
		);

		// Add hidden fields.
		$fields[] = array(
			'id'    => 'llms_reset_key',
			'type'  => 'hidden',
			'value' => $key,
		);
		$fields[] = array(
			'id'    => 'llms_reset_login',
			'type'  => 'hidden',
			'value' => $login,
		);

		/**
		 * Filter password reset form fields.
		 *
		 * @since 5.0.0
		 *
		 * @param array[] $fields   Array of form field arrays.
		 * @param string  $key      User password reset key, usually populated via $_GET vars.
		 * @param string  $login    User login (username), usually populated via $_GET vars.
		 * @param string  $location Location where the fields were retrieved from. Either "checkout", "registration", or "fallback".
		 *                          Fallback denotes that no password field was located in either of the previous forms so a default
		 *                          set of fields is generated programmatically.
		 */
		return apply_filters( 'llms_password_reset_fields', $fields, $key, $login, $location );

	}


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.