I'm trying to compare the user password from different databases so users of other drupal sites can also login. I'm switching from the main database to other databases and then trying to compare the passwoord input field to the stored hash value.

I did not found a answer on this site maybe because my situation is a bit different.

I did found this question and tried user_check_password() and user_hash_password() returns nothing and user_hash_password returns a new hash every time I run it so I don't think I can use that to compare that to the stored value in the database.

  • You know, it's kinda deliberately hard to compare password with foreign database password hash. Why not to expose some kind of login webservice on the source page?
    – Mołot
    Aug 21, 2013 at 12:49
  • The users must be able to login on every website so the login can not be on the source page. But your saying it's not really possible to compare the password with a foreign database password?
    – FLY
    Aug 21, 2013 at 12:55
  • It is possible, but salt is there to make it as inconvenient as possible in case database gets stolen and someone wants to brute-force it. About the login - look here. You can login to Stack Exchange via any of Stack pages and be logged in on them all all right. I meant something like this - as far as I know it is possible with Drupal.
    – Mołot
    Aug 21, 2013 at 12:59

1 Answer 1


If I copy the user from the other database and save it to the main database user_check_password() does work. While I don't like this it does work…

If you have a better answer please submit it.

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.