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] Password reset clears First Name 😕

Simple Membership Plugin › Forums › Simple Membership Plugin › Password reset clears First Name 😕

  • This topic has 12 replies, 3 voices, and was last updated 1 year, 9 months ago by admin.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • December 13, 2024 at 5:54 am #29198
    profgus
    Participant

    Hello there,

    I was just wondering if this has already happened to someone, or if it’s just me: I have set up a series of automations to create members using the API. However, when these members decide to reset their passwords (I automatically include a link for that in the welcome e-mail), their first names get erased from their records within SWMP.

    Any help is much appreciated! Thanks in advance,
    Gustavo

    December 14, 2024 at 1:54 am #29200
    The Assurer
    Moderator

    I have set up a series of automations to create members using the API.

    What kind of “automations?” How are they started? By the server or the member?

    If you manually create a member, either as the admin or a new user; does the problem occur?

    December 14, 2024 at 2:33 am #29202
    profgus
    Participant

    Thank you for your quick reply!

    The automation is based on a webhook I receive from the payment processor. I’m in Brazil, and payment is being handled externally. Then I extract data from the payload – more specifically, first_name, last_name and email –, use the email address as user_name, set a temporary password using a generator, set the membership level and set send_email to 1.

    This user creation process has been tested extensively and is functional. As I’ve described in the previous message, the issue I’m experiencing only happens when a member clicks on the password reset link and chooses a new password: the first_name field immediately becomes blank.

    Thanks again! All the best,
    Gustavo

    December 15, 2024 at 3:25 am #29203
    The Assurer
    Moderator

    Do you have the debug logs turned on, and have you checked for any obvious issues in the logs? In the meantime, I will refer this to the developer; because it involves external payment processing.

    Also, the name data returned by the payment processor… what character encoding is being used?

    December 15, 2024 at 3:45 pm #29206
    admin
    Keymaster

    At the time, the password reset is clicked, does the corresponding WP user entry have a value in the “first name” field? Do a test yourself by recreating the issue so you can check if the WP user entry has a value in the first name field.

    December 16, 2024 at 12:21 am #29207
    profgus
    Participant

    Hello again,

    Thank you very much for looking into this. I have just used the payment processor’s test environment to create a user using the API exactly as it’s being done from their production environment. The user is being created on SWMP with correct information in each field, including first_name, last_name, email, user_name, password, membership_level, send_email, subscription_starts and member_since.

    Screenshots:
    https://drive.google.com/open?id=1bDu4Z17-n9H1Eg59Ho6c2HkZ1s6SVnYU&usp=drive_fs
    https://drive.google.com/open?id=1bIbwopXMHazRILsJBe8Ep6V-TEBXSqh_&usp=drive_fs
    https://drive.google.com/open?id=1bLekYhamBEZpE5dJ5ki6KOQn8d_8dk1G&usp=drive_fs

    However, the corresponding WP user entry’s name field is empty.

    Screenshot:
    https://drive.google.com/open?id=1bPnH-YfbmeXOxKfkIZ6xqridyvr7IukG&usp=drive_fs

    I have just updated the password from the reset link and confirmed that both first_name and last_name are now empty on SWMP. All other fields remain unchanged.

    Screenshot:
    https://drive.google.com/open?id=1bSrGq0MJ6TlfBvWsfUHksLYw6-uIo9Hc&usp=drive_fs

    So in fact it seems like creating SWMP user from the API isn’t causing first_name and last_name to be updated on the corresponding WP user profile.

    By the way, there are no apparent issues related to encoding (I’m in Brazil, and names containing letters with accents are quite common). I have also turned debugging on, but didn’t find anything unusual.

    Once again, thank you very much for your help! Best regards,
    Gustavo

    December 16, 2024 at 12:27 am #29209
    The Assurer
    Moderator

    I have just used the payment processor’s test environment…

    Is this test environment equivalent to a “sandbox” environment? What happens if you run your test, using a non-test environment?

    December 16, 2024 at 1:34 am #29210
    profgus
    Participant

    Hello again,

    The test environment is the equivalent of what you would call a “sandbox”. The behavior is exactly the same because the webhook’s payload isn’t different from one environment to another. In addition, the issue I have described in my previous posts has been verified in transactions originated from both, production and test environments. It just doesn’t make sense for my own tests to be made using the production environment because I would ultimately have to pay for my own course in order to run a test!

    All the best,
    Gustavo

    December 16, 2024 at 2:13 am #29211
    admin
    Keymaster

    Please provide the script that you are using for the “create” user API call so I can review it:

    https://simple-membership-plugin.com/simple-membership-api-creating-member-account-using-http-post-request/

    Are you sending a username and password with the “create” request?

    December 16, 2024 at 10:07 pm #29213
    profgus
    Participant

    Hello again,

    Based on my own research, I just wanted to add that the website I’m referring to on this thread is part of a WordPress multisite installation.

    I also found this post on WordPress’ SWMP forum:

    https://wordpress.org/support/topic/first-last-name-mapping-to-wordpress-users/#post-16996822

    Interestingly enough, I also found out that, if I visit the member’s profile page from a member just created using the API (as such, with first_name and last_name populated) and click on “Save Data”, these fields are updated in the corresponding WordPress user profile. So, although I understand the idea behind the statement “to make sure that we don’t create an issue by updating the WP user profile that may have been configured from another site on that network”, I’m still wondering why the option to update first_name and last_name on the WordPress user profile can’t be made available for multisite installs. If this was such a delicate concern, then clicking on “Save Data” should have no effect on these fields as they relate to the WP user profile.

    By the way, this wouldn’t be an issue if first_name and last_name persisted in the SWMP database regardless of how they’re being handled on the WP user profile side. The problem, as I mentioned earlier in this thread, is that sometimes these fields are being kept in sync (when updating a password, for example), and sometimes they are not (when a user is created).

    Thank you for your support! Best regards,
    Gustavo

    December 16, 2024 at 11:02 pm #29214
    profgus
    Participant

    Update: I managed to make it work the way I wanted. Following is a link to the updated custom-functions.php file:

    https://drive.google.com/open?id=1uTjiDfkCg3y80-0dPXIyoegvo6uhnmSX&usp=drive_fs

    Thanks again for the insightful replies! All the best,
    Gustavo

    December 17, 2024 at 12:31 am #29212
    profgus
    Participant

    Hello again,

    Here’s a link to the “custom-functions.php” which includes the function you specifically requested, named “handle_payment_webhook”:

    https://drive.google.com/open?id=1bTpl4ygyPP9wgj7QCg_W2LB-k3hEgLRn&usp=drive_fs

    You will notice that I have implemented this set of functions as a custom plugin and also that there is a configuration page which is there I provide Simple Membership’s API key (webhook_api_key) and the membership level (webhook_membership_level) for user creation. The third configuration option, “item description” (webhook_item_description), corresponds to the name of the specific course that is being offered in each website to make sure that the user creation only happens when there’s a match with the name provided as part of the webhook’s payload. This last configuration option has no direct relation with SWMP.

    Following is a link to an complete example of the webhook’s payload:

    https://drive.google.com/open?id=1bck6pkb2CxMLzRkPIKPxIudaYPsARY6b&usp=drive_fs

    Finally, I’m not sending any username/password combination when I send the “create” request. I also can’t think of any reference to that in the API documentation, but of course I may be just unaware of it.

    Thanks again! All the best,
    Gustavo

    December 19, 2024 at 5:16 am #29225
    admin
    Keymaster

    Hi,

    Thank you. The fields marked in the “Optional Additional Parameter” section are optional but for your use case, those should be sent in the request:

    https://simple-membership-plugin.com/simple-membership-api-creating-member-account-using-http-post-request/#optional-additional-parameter

    So definitely send the username and password field in the API call.

    For your use case, you should send all the following parameters:

    – first_name
    – last_name
    – email
    – user_name
    – password
    – membership_level

    Let me know if that works better.

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 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