Created
September 7, 2022 22:54
-
-
Save nikitasinelnikov/c1fc4e229e0d314fdb06da95cad63e62 to your computer and use it in GitHub Desktop.
Ultimate Member v3: Password Reset 'um_resetpass_form_args' hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 'um_change_password_page_hidden_fields' - use filter's hook `um_resetpass_form_args` instead and add the hiddens to it | |
/** | |
* Description: Fires before rendering the lost password form and filters the lost password arguments. | |
* This hook may be used to add custom hidden fields or display custom content in the password reset form header. | |
* | |
* Hook: um_resetpass_form_args | |
* | |
* Type: filter | |
* | |
* @package um\core | |
* @since 3.0.0 | |
* | |
* @param array $args Reset Password form arguments necessary for init form. | |
*/ | |
function my_resetpass_form_args( $args ) { | |
// default array for the arguments. | |
/* $args = array( | |
'id' => 'um-resetpass', | |
'class' => 'um-top-label um-center-always', | |
'prefix_id' => '', | |
'fields' => array( | |
array( | |
'type' => 'password', | |
'label' => __( 'New Password', 'ultimate-member' ), | |
'id' => 'user_password', | |
'required' => true, | |
'value' => '', | |
'placeholder' => __( 'Enter new Password', 'ultimate-member' ), | |
), | |
array( | |
'type' => 'password', | |
'label' => __( 'Confirm Password', 'ultimate-member' ), | |
'id' => 'confirm_user_password', | |
'required' => true, | |
'value' => '', | |
'placeholder' => __( 'Confirm Password', 'ultimate-member' ), | |
) | |
), | |
'hiddens' => array( | |
'um-action' => 'password-reset', | |
'rp_key' => $rp_key, | |
'login' => $login, | |
'nonce' => wp_create_nonce( 'um-resetpass' ), | |
), | |
'buttons' => array( | |
'save-password' => array( | |
'type' => 'submit', | |
'label' => __( 'Save Password', 'ultimate-member' ), | |
), | |
), | |
); */ | |
// you may change hiddens for this form | |
$args['hiddens']['{hidden_name}'] = '{hidden value}'; | |
// you may add fields to this form | |
$args['fields'][] = array( | |
// {field data} see necessary arguments for the fields in ultimate-member/includes/frontend/class-form.php | |
// 'id' and 'type' are required | |
); | |
return $args; | |
} | |
add_filter( 'um_resetpass_form_args', 'my_resetpass_form_args', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment