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:
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.
1. Updating Member Account Using HTTP GET request
In order to update a member account via HTTP GET request, use the following format:
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.