check_password
Filters whether the plaintext password matches the hashed password.
Использование
add_filter( 'check_password', 'wp_kama_check_password_filter', 10, 4 );
/**
* Function for `check_password` filter-hook.
*
* @param bool $check Whether the passwords match.
* @param string $password The plaintext password.
* @param string $hash The hashed password.
* @param string|int $user_id Optional ID of a user associated with the password. Can be empty.
*
* @return bool
*/
function wp_kama_check_password_filter( $check, $password, $hash, $user_id ){
// filter...
return $check;
}
- $check(true|false)
- Whether the passwords match.
- $password(строка)
- The plaintext password.
- $hash(строка)
- The hashed password.
- $user_id(строка|int)
- Optional ID of a user associated with the password. Can be empty.
Список изменений
| С версии 2.5.0 | Введена. |
| С версии 6.8.0 | Passwords are now hashed with bcrypt by default. Old passwords may still be hashed with phpass or md5. |
Где вызывается хук
check_password
wp-includes/pluggable.php 2882
return apply_filters( 'check_password', $check, $password, $hash, $user_id );