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] create user with API

Simple Membership Plugin › Forums › Simple Membership Plugin › create user with API

Tagged: api, API Addon, HTTP POST

  • This topic has 3 replies, 2 voices, and was last updated 1 year ago by admin.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • May 15, 2025 at 4:13 am #30400
    gipsea
    Participant

    Dear all,

    I’m new with the use of API. I tried query and login action successfully but I continue to receive error message.

    This is the request:

    [2025-05-14T17:52:48.082Z] Registration Request Successful
    Request URL: https://myurl/wp-json/?key=mykey&swpm_api_action=create&username=USER&email=EMAIL&password=PWD&first_name=NAME&last_name=LASTNAME&membership_level=2
    Data Sent: {
      "username": "USER",
      "email": "EMAIL",
      "password": "PWD",
      "first_name": "NAME",
      "last_name": "LASTNAME",
      "membership_level": "2"
    }
    Response: {
      "success": false,
      "message": "Missing one of the mandatory fields: first_name, last_name, email. Ensure that you are using HTTP POST method to send the data.",
      "requestUrl": "https://myurl/wp-json/?key=mykey&swpm_api_action=create&username=USER&email=EMAIL&password=PWD&first_name=NAME&last_name=LASTNAME&membership_level=2",
      "data": {
        "result": "failure",
        "message": "Missing one of the mandatory fields: first_name, last_name, email. Ensure that you are using HTTP POST method to send the data."
      }
    }

    This is the log msg as I created. I’m using POST and the fields seams correct to me but still getting the message. Is there a log from the server side or within the plugin that I can check?

    Thanks

    May 15, 2025 at 4:19 am #30402
    admin
    Keymaster

    The query parameters may be getting stripped by a security or firewall plugin on your site. It’s worth checking if that’s the case. Enable the debug log feature to view the full list of parameters received by the API addon on the server side.

    Note: The request should be sent to your site’s homepage URL. The examples folder included in the addon contains sample code you can test with. Start with the basic example to verify it’s working, then build on it as needed.

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

    May 16, 2025 at 4:49 pm #30414
    gipsea
    Participant

    @admin thanks for your reply.

    at the end I revised the code, enabled CORS and finally I moved 2 steps forward but one step backward ahahah

    At the moment, the remote form is able to create a new user but only in the simple membership members without syncing with the WP users nor it seams it triggers to send the activation email. Also as side error, in the SM members, the username is shown as [incomplete]

    checking the API documentation I understood I only have to define a create query.

    Am I doing anything wrong? Have I missed any piece of information?

    thanks again

    May 17, 2025 at 7:09 am #30415
    admin
    Keymaster

    It’s likely that the username and password values are not being included in your API request. Without these details, the system cannot create the corresponding WordPress user account.

    To investigate further, edit the following file from the API addon:

    swpm-api/classes/class.swpm-api-profile-endpoints.php

    Search for the following line of code in this file:

    SwpmUtils::create_wp_user( $wp_user_info );

    Add some debug code before or after this line to confirm whether your API call is reaching this point.

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