Using Gravity Forms ‘gform_userregistration_login_form’ PHP filter

The gform_userregistration_login_form filter allows you to modify the login form object used in the Gravity Forms Login Widget. This filter is primarily used with the User Registration Add-On for Gravity Forms.

Usage

add_filter('gform_userregistration_login_form', 'your_function_name', 10, 1);

Parameters

  • $form (Form Object): The Form Object of the login form.

More information

See Gravity Forms Docs: gform_userregistration_login_form

Source Code: This filter is located in GF_User_Registration::login_form_object() in gravityformsuserregistration/class-gf-user-registration.php.

Examples

Change label for Username field

Change the label of the Username field to “Please enter your username”.

add_filter('gform_userregistration_login_form', 'change_login_username', 10, 1);

function change_login_username($form) {
    $fields = $form['fields'];
    foreach ($fields as &$field) {
        if ($field->label == 'Username') {
            $field->label = 'Please enter your username';
        }
    }
    return $form;
}

Remove Remember Me field

Remove the “Remember Me” field from the login form.

add_filter('gform_userregistration_login_form', function($form) {
    // Remove Remember Me field.
    unset($form['fields']['2']);
    return $form;
});

Change Login button text

Change the text on the Login button to “Go!”.

add_filter('gform_userregistration_login_form', function($form) {
    $form['button']['text'] = 'Go!';
    return $form;
});