0

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
  • 1
    What have you done so far? With the custom script, you can connect to WP as usual.
    – bravokeyl
    Commented Nov 27, 2017 at 5:27

1 Answer 1

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.