WordPress Membership

Easy to use WordPress Membership plugin

  • Documentation
  • WP eMember Plugin
  • Projects
  • Home

API – Updating A Member Account Using HTTP GET or POST

This documentation is only for developers. If you are not a developer with good PHP coding skills then you have no need to read this.

If you want to update a member account using a HTTP GET or POST request then use this documentation.

Enabling the API

WP eMember plugin has an API that allows you to update a member account using a standard HTTP GET or POST request. If you want to use this API then you need to enable it from the settings menu of the plugin first. The following is a screenshot of this section in the settings menu:


It is very important that you do not reveal the Secret Word/API key to anyone else.

Using the API

Once you enable it, you can start to send HTTP request to the following URL to update member accounts remotely or from another software/application:

http://www.example.com/wp-content/plugins/wp-eMember/api/update.php

You need a minimum of 2 pieces of information to send an update request. These are:

  • Secret Word/API Key (you specified it in the settings menu of the plugin)
  • Member ID (the user whose details you want to update)

Optionally, you can pass the following fields with the request to update the values of those fields for the member’s account in question.

  • title
  • first_name
  • last_name
  • email
  • password
  • phone
  • address_street
  • address_city
  • address_state
  • address_zipcode
  • country
  • gender
  • company_name
  • membership_level_id
  • account_state
  • subscription_starts

1. Updating Member Account Using  HTTP GET request

In order to update a member account via HTTP GET request, use the following format:

http://www.example.com/wp-content/plugins/wp-eMember/api/update.php?secret_key=XX&member_id=XX&first_name=XX&last_name=XX

Replace the “example.com” and “XX” with the appropriate values.

PHP Code Example:The following is an example of how to construct this URL using PHP:

$secret_key = "6bd39ewe43a7bb";
$member_id= "1";
$first_name= "Jon";
$last_name= "Doe";

$prepared_data = "?secret_key=".$secret_key."&member_id=".$member_id."&first_name=".$first_name."&last_name=". $last_name;
$get_url = "http://www.example.com/wp-content/plugins/wp-eMember/api/update.php".$prepared_data;
// Execute this GET Request
file_get_contents($get_url);

2. Updating Member Account Using  HTTP POST request

To update a member account via HTTP POST use the following format:

<form method="post" action="http://www.example.com/wp-content/plugins/wp-eMmeber/api/update.php">
<input type="hidden" name="secret_key" value="XX">
<input type="hidden" name="member_id" value="XX">
<input type="hidden" name="first_name" value="XX">
<input type="hidden" name="last_name" value="XX">
<input type=submit value="Submit Post">
</form>

Replace the “example.com” and “XX” with the appropriate value.

Filed Under: Additional Resources Tagged With: 3rd party integration, API, emember extension, WP eMember

Comments

  1. admin says:

    @Chris, The ID value (which can’t be modified by the member from the front-end) is the best reference to use when updating a profile.

    You can query the member’s profile using the email address. See the following link:
    https://www.tipsandtricks-hq.com/wordpress-membership/api-querying-a-member-profile-using-http-get-or-post-1378

    You will get the ID value from that query.

  2. Chris Brown says:

    To update a member’s details, it requests the member_id. Short of looking this up in wp_admin, and manually creating the GET / POST etc, is this value returned via the “create.php” code? Or can it – like other sections – use the customer’s email address?

  3. admin says:

    @Andrea, If you have the secondary level feature enabled, then calling the update function with a “membership_level_id” value will create the following behavior:

    1) The current level will be pushed to the secondary level.
    2) Then the new level will be assigned as the main membership level for the user.

  4. Andrea says:

    Hi!

    Is it possible to add an additional (second) membership level through API?
    Which field should I use?

    Thanks!

  5. admin says:

    @Chris, You configure the subscription duration settings in the membership level. Then when you create a member account using the API, you can specify which membership level this user will go to to.

  6. Chris says:

    Can we pass the subscription duration using HTTP?

  7. admin says:

    So far users have asked for the following capability via API:

    – Create members
    – Update members
    – Deactivate members

    If you explain exactly what you need, we should be able to add an option for that.

  8. Frank says:

    There doesn’t seem to be a query API. So how could one “query all the current members via the API?”?

  9. admin says:

    @Graycloud, You could call this API in a loop for each member from your application.

  10. graycloud rios says:

    is there a way to query all the current members via the API?

    thank you

  11. admin says:

    @Vikto, Yes you can update the member’s password too. Send the value in a field named ‘password’ to update it.

  12. Viktor says:

    Is it possible to update password through this update API?
    I’m trying to connect it with our client management platform.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the WP eMember Plugin

Get WP eMember

Categories

  • Additional Resources
  • Content Protection
  • Design & Usage
  • eMember Addon
  • Installation
  • Integration
  • License
  • Testing
  • Uncategorized
  • Video Tutorial

Recent Comments

  • Chris Brown on API – Querying A Member Profile Using HTTP GET or POST
  • admin on API – Updating A Member Account Using HTTP GET or POST
  • Chris Brown on API – Updating A Member Account Using HTTP GET or POST
  • admin on API – Updating A Member Account Using HTTP GET or POST
  • Andrea on API – Updating A Member Account Using HTTP GET or POST

Featured WordPress Plugins

wordpress_estore_icon
wordpress membership plugin icon
WP Express Checkout Plugin
WordPress Lightbox Ultimate Plugin
WordPress Photo Seller Plugin
wordpress_affiliate_plugin_icon

Copyright © 2023 | WP Membership Plugin