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.
WP eMember plugin has an API that allows you to create a member account using a standard HTTP GET or POST request.
Enabling the API
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 create member account remotely or from another software:
You need a minimum of 5 pieces of information to create a member account using a HTTP request. These are:
- Secret Word/API Key (you specified it in the settings menu of the plugin)
- First Name
- Last Name
- Email Address
- Membership Level ID
Optionally, you can pass in the following data with the request (if you do not pass these, a randomly generated value will be used for these)
1. Creating Member Account Using HTTP GET request
In order to create a member account via HTTP GET 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 link using PHP:
$secret_key = "6bd39ewe43a7bb"; $first_name= "Jon"; $last_name= "Doe"; $email= "firstname.lastname@example.org"; $membership_level_id= "1"; $prepared_data = "?secret_key=".$secret_key."&first_name=".$first_name."&last_name=". $last_name."&email=".$email."&membership_level_id=".$membership_level_id; $get_url = "http://www.example.com/wp-content/plugins/wp-eMember/api/create.php".$prepared_data; // Execute this GET Request file_get_contents($get_url);
2. Creating Member Account Using HTTP POST request
To create a member account via HTTP POST use the following format:
<form method="post" action="http://www.example.com/wp-content/plugins/wp-eMmeber/api/create.php"> <input type="hidden" name="secret_key" value="XX"> <input type="hidden" name="first_name" value="XX"> <input type="hidden" name="last_name" value="XX"> <input type="hidden" name="email" value="XX"> <input type="hidden" name="membership_level_id" value="XX"> <input type=submit value="Submit Post"> </form>
Replace the ‘example.com’ and ‘XX’ with the appropriate value.
Passing Additional Field Values
You can optionally pass additional field values using the following parameters in your request: