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.
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: ''
Return Return
(array[])
Source Source
File: includes/class.llms.person.handler.php
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | 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 ); } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |