LLMS_Person_Handler::find_password_fields( string $location )

Locate password fields from a given form location.


Parameters Parameters

$location

(string) (Required) From location.


Top ↑

Return Return

(false|array[])


Top ↑

Source Source

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

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
protected static function find_password_fields( $location ) {
 
    $forms = LLMS_Forms::instance();
    $all   = $forms->get_form_fields( $location );
 
    $pwd = $forms->get_field_by( (array) $all, 'id', 'password' );
 
    // If we don't have a password in the form return early.
    if ( ! $pwd ) {
        return false;
    }
 
    // Setup the return array.
    $fields = array( $pwd );
 
    // Add confirmation and strength meter if they exist.
    foreach ( array( 'password_confirm', 'llms-password-strength-meter' ) as $id ) {
 
        $field = $forms->get_field_by( $all, 'id', $id );
        if ( $field ) {
 
            // If we have a confirmation field ensure that the fields sit side by side.
            if ( 'password_confirm' === $id ) {
 
                $fields[0]['columns']         = 6;
                $fields[0]['last_column']     = false;
                $fields[0]['wrapper_classes'] = array();
 
                $field['columns']         = 6;
                $field['last_column']     = true;
                $field['wrapper_classes'] = array();
 
            }
 
            $fields[] = $field;
        }
    }
 
    return $fields;
 
}


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.