Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gravity Wiz // Gravity Forms // Validate Current Password
<?php
/**
* Gravity Wiz // Gravity Forms // Validate Current Password
* http://gravitywiz.com/
*/
// update "123" to your form ID, update "6" to your Password field ID
add_filter( 'gform_field_validation_1639_1', function( $result, $value ) {
$user = wp_get_current_user();
if ( ! wp_check_password( $value, $user->data->user_pass, $user->ID ) ) {
$result['is_valid'] = false;
$result['message'] = 'Invalid current password. Please try again.';
}
return $result;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.