Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Resolved] How to use the REST query to verify a member?

Simple Membership Plugin › Forums › Simple Membership Plugin › How to use the REST query to verify a member?

  • This topic has 4 replies, 2 voices, and was last updated 3 years, 7 months ago by Stefan.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • April 16, 2023 at 4:46 pm #25956
    Stefan
    Participant

    Hi all,

    I have a very simple question. With the simple REST API I can query all a users credentials. I just want to write a simple script which processes username and password from the outside, checking if they are valid, so I thought I could generate a hash from the plain password and compare it with the password of the query. Unfortunately I cannot find a way to produce the same hash as in the query on my server using PHP.

    I have already seen that someone pointed out to the WordPress docs about the password hashing methods. But these don’t work as expected – they produce a different hash with each call, and none of them compares to the one of the query. Any hint would be appreciated.

    April 16, 2023 at 8:07 pm #25957
    Stefan
    Participant

    It comes down to the question what exactly the password (hash) in the query result is coming from.

    If I take a random password, hash it with wp_create_password() and immediately check it with wp_check_password(), the result is true. So far, so good 🙂

    If I create a new user with the password “123456789”, the query produces a result. If I check that with wp_check_password(), the result is false.

    So far I see two possible reasons:

    1. The passwords by Simple Membership haven’t been created on the column “password” but on something else…

    2. The passwords by Simple Membership haven’t been created by a wp_create_password() call…

    3. The code behind wp_check_password() in my test environment is not the same as used in my WordPress installation (unlikely since this framework code hasn’t been the subject to changes for a long time).

    Any ideas?

    April 17, 2023 at 12:18 am #25960
    The Assurer
    Moderator

    The SWPM passwords are hashed using public static function encrypt_password( $plain_password ) in the class.swpm-utils.php file.

    April 17, 2023 at 7:58 am #25962
    Stefan
    Participant

    Thank you – but I don’t suppose so. The code there is identical with the wp_create_hash()-example (using HashPassword() of a PasswordHash instance with (8,true) – and it produces something different from the password field of the query result.

    April 17, 2023 at 8:56 am #25963
    Stefan
    Participant

    [Solved] The problems were added backslashes in the query result, so it didn’t match the database content. Processing the result through stripslashes() did the job. Thanks again.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy