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.

Top ↑

Parameters Parameters


(array[]) (Required) Array of parsed WP_Block arrays.


(string) (Required) The form location ID.

Top ↑

Return Return


Top ↑

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;


Top ↑

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.