I have a wordpress membership site running with users already signed up. I currently installed a new php script on the same mysql database which will require existing user to signup. I would like the php script make use of the wordpress users table. Please help!
1 Answer
WordPress use a special password hash then you need to send the password and the hash to the PHP code of WordPress to know if it's valid.
This can be done with creating a new REST endpoint or with including the file "wp-includes/class-phpass.php" of WordPress and use it like this :
require_once "class-phpass.php";
$wp_hasher = new PasswordHash(8, TRUE);
$correct = $wp_hasher->CheckPassword($enteredPassword, $hashFromDatabse));
// $correct contains TRUE or FALSE