Skip to content

Instantly share code, notes, and snippets.

@spivurno
Last active October 13, 2021 14:39
Show Gist options
  • Save spivurno/eebad70856ec3be400ccdeface37479a to your computer and use it in GitHub Desktop.
Save spivurno/eebad70856ec3be400ccdeface37479a to your computer and use it in GitHub Desktop.
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 );
@spivurno
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment