Confirm password for form widget registration action

Why not :slight_smile: . Take a look at documentation.

Place your form to template. Add Name, Email and 2 password fields.

Assign Registration and Custom action to your form.

Create your custom action.

add_action( 'bricks/form/custom_action', 'password_matching', 10, 1 );

function password_matching( $form ) {
    $form_fields = $form->get_fields();

    $form_id = "id"; // your form ID
    $password_id = "id"; // your password form field ID
    $con_password_id = "id"; // your confirm password form field ID

    $ch_form = $form_fields[$form_id];
    $ch_password = $form_fields[$password_id];
    $ch_con_password = $form_fields[$con_password_id];

    // Check if the form id is the one you want
    if ( $ch_form !== 'yourFormID' ) {
        return;
    }

    // Check passwords
    if ($ch_password !== $ch_con_password) {
        // Passwords do not match
        wp_die('Passwords do not match. Please try again.');
    }

    // continue with your code....

of course there is bit more to it but this should give you some starting points :wink:

2 Likes