LLMS_Forms_Dynamic_Fields::modify_account_form( array[] $blocks, string $location )
Modifies account form to improve the UX of editing the email address and password fields
Description Description
Adds a "Current Password" field used to verify the existing user password when changing passwords.
Forces email & password fields to be required and makes them disabled and visually hidden on page load.
Adds a toggle button for each set of fields, when the toggle is clicked the fields are revealed and enabled so they can be used. Ensuring that the fields are only required when they’re being explicitly changed.
Parameters Parameters
- $blocks
-
(array[]) (Required) Array of parsed WP_Block arrays.
- $location
-
(string) (Required) The form location ID.
Return Return
(array[])
Source Source
File: includes/forms/class-llms-forms-dynamic-fields.php
public function modify_account_form( $blocks, $location ) { // Only add toggles on the account edit form. if ( 'account' !== $location ) { return $blocks; } $blocks = $this->modify_toggle_blocks( $blocks ); foreach ( array( 'email_address', 'password' ) as $id ) { $field = $this->find_block( $id, $blocks ); $blocks = $field ? $this->{"toggle_for_$id"}( $field, $blocks ) : $blocks; } return $blocks; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |