Adds a member to WordPress according to the specified arguments.
Parameters
- args (array) – An array of accepted arguments specified below:
Parameter | Description | Required | Default |
---|---|---|---|
user_login (string) | User login (username) | Required | |
user_email (string) | User's email address | Required | |
user_pass (string) | Password. Auto-generated if not specified | Optional | auto-generated |
company (string) | Company name | Optional | |
address1 (string) | Address line #1 | Optional | |
address2 (string) | Address line #2 | Optional | |
city (string) | City | Optional | |
state (string) | State | Optional | |
zip (string) | Zip code | Optional | |
country (string) | Country | Optional | |
wpm_login_limit (int) | Number of concurrent logins to allow per IP | Optional | |
wpm_registration_ip (string) | IP address during user registration | Optional | |
custom_{field} (string) | Custom fields. Custom fields can be added by prepending a variable name with “custom_” (e.g. custom_phone) | Optional | |
Sequential (boolean) | Enables/Disables sequential upgrade for user | Optional | |
Levels (array) | Array of membership level IDs to add the user to | Optional | |
RemoveLevels (array) | Array of membership level IDs to remove the user from | Optional | |
SendMail (boolean) | Send appropriate WishList Member emails or not. (Requires the “Levels” parameter to be set in order to work.) | Optional | |
SendMailPerLevel (boolean) | Send appropriate WishList Member emails based on the per level settings. (Requires the “Levels” parameter to be set in order to work.) | Optional | |
ObeyRegistrationRequirements (boolean) | Follows the configured settings in the Setup > Levels > *Click to edit Level* > Requirements section of WishList Member. (Requires the “Levels” parameter to be set in order to work.) | Optional |
Return
Returns a multi-dimensional array containing operation status and an array containing full member data for the newly added user.
Example Code
<?php $args = array( 'user_login' => 'johnistheman, 'user_email' => 'jmodaman@wlptest.com', 'Levels' => array(1340726008, 1340896239) ); $member = wlmapi_add_member($args); print_r($member); ?>
Example Output
Array ( [success] => 1 [member] => Array ( [0] => Array ( [ID] => 13 [UserInfo] => Array ( [ID] => 13 [caps] => Array ( [subscriber] => 1 ) [cap_key] => wp_capabilities [roles] => Array ( [0] => subscriber ) [allcaps] => Array ( [read] => 1 [level_0] => 1 [subscriber] => 1 ) [filter] => [user_login] => johnistheman [user_nicename] => johnistheman [user_email] => jmodaman@wlptest.com [user_url] => [user_registered] => 2012-12-10 15:54:56 [user_activation_key] => [user_status] => 0 [display_name] => johnistheman [wpm_useraddress] => 0 ) [Sequential] => [Levels] => Array ( [1340726008] => stdClass Object ( [Level_ID] => 1340726008 [Name] => Test Level 1 [Cancelled] => [CancelDate] => [Pending] => [UnConfirmed] => [Expired] => [ExpiryDate] => [Active] => 1 [Status] => Array ( [0] => Active ) [Timestamp] => 1355154896 [TxnID] => WL-13-1340726008 ) [1340896239] => stdClass Object ( [Level_ID] => 1340896239 [Name] => Test Level 2 [Cancelled] => [CancelDate] => [Pending] => [UnConfirmed] => [Expired] => [ExpiryDate] => [Active] => 1 [Status] => Array ( [0] => Active ) [Timestamp] => 1355154896 [TxnID] => WL-13-1340896239 ) ) ) ) [supported_verbs] => Array ( [0] => GET [1] => PUT [2] => DELETE ) )
Notes
This functions returns WLMAPIMethods::add_member($args) in core/api-helper/class-api-methods.php