Updates a member according to the specified arguments.
Parameters
- user_id (int) – The ID of the member to update
- 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 (integer) | 1-Set Sequential Upgrade to ON 0-Set Sequential Upgrade to OFF |
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 |
Return
Returns a multi-dimensional array containing operation status and an array containing full member data for the newly updated user.
Example Code
<?php
$args = array(
'user_email' => '[email protected]',
'Levels' => array(1340896250)
);
$member = wlmapi_update_member($args);
print_r($member);
?>
Example Output
Array
(
[success] => 1
[member] => Array
(
[0] => Array
(
[ID] => 1
[UserInfo] => Array
(
[ID] => 1
[caps] => Array
(
[SPF Manage Options] => 1
[SPF Manage Forums] => 1
[SPF Manage User Groups] => 1
[SPF Manage Permissions] => 1
[SPF Manage Tags] => 1
[SPF Manage Components] => 1
[SPF Manage Admins] => 1
[SPF Manage Users] => 1
[SPF Manage Profiles] => 1
[SPF Manage Toolbox] => 1
[SPF Manage Configuration] => 1
[gform_full_access] => 1
[SPF Manage Themes] => 1
[SPF Manage Plugins] => 1
[administrator] => 1
)
[cap_key] => wp_capabilities
[roles] => Array
(
[14] => administrator
)
[allcaps] => Array
(
[switch_themes] => 1
[edit_themes] => 1
[activate_plugins] => 1
[edit_plugins] => 1
[edit_users] => 1
[edit_files] => 1
[manage_options] => 1
[moderate_comments] => 1
[manage_categories] => 1
[manage_links] => 1
[upload_files] => 1
[import] => 1
[unfiltered_html] => 1
[edit_posts] => 1
[edit_others_posts] => 1
[edit_published_posts] => 1
[publish_posts] => 1
[edit_pages] => 1
[read] => 1
[level_10] => 1
[level_9] => 1
[level_8] => 1
[level_7] => 1
[level_6] => 1
[level_5] => 1
[level_4] => 1
[level_3] => 1
[level_2] => 1
[level_1] => 1
[level_0] => 1
[edit_others_pages] => 1
[edit_published_pages] => 1
[publish_pages] => 1
[delete_pages] => 1
[delete_others_pages] => 1
[delete_published_pages] => 1
[delete_posts] => 1
[delete_others_posts] => 1
[delete_published_posts] => 1
[delete_private_posts] => 1
[edit_private_posts] => 1
[read_private_posts] => 1
[delete_private_pages] => 1
[edit_private_pages] => 1
[read_private_pages] => 1
[delete_users] => 1
[create_users] => 1
[unfiltered_upload] => 1
[edit_dashboard] => 1
[update_plugins] => 1
[delete_plugins] => 1
[install_plugins] => 1
[update_themes] => 1
[install_themes] => 1
[update_core] => 1
[list_users] => 1
[remove_users] => 1
[add_users] => 1
[promote_users] => 1
[edit_theme_options] => 1
[delete_themes] => 1
[export] => 1
[SPF Manage Options] => 1
[SPF Manage Forums] => 1
[SPF Manage User Groups] => 1
[SPF Manage Permissions] => 1
[SPF Manage Tags] => 1
[SPF Manage Components] => 1
[SPF Manage Admins] => 1
[SPF Manage Users] => 1
[SPF Manage Profiles] => 1
[SPF Manage Toolbox] => 1
[SPF Manage Configuration] => 1
[gform_full_access] => 1
[SPF Manage Themes] => 1
[SPF Manage Plugins] => 1
[administrator] => 1
)
[filter] =>
[user_login] => username
[user_nicename] => username
[user_email] => [email protected]
[user_url] =>
[user_registered] => 2012-06-18 20:00:43
[user_activation_key] =>
[user_status] => 0
[display_name] => John Morris
[custom_] =>
[custom_0] =>
[custom_john_test] =>
[wpm_login_date] => 1355159065
[wpm_login_ip] => 127.0.0.1
[wpm_login_limit] =>
[wpm_useraddress] => Array
(
[company] =>
[address1] =>
[address2] =>
[city] =>
[state] =>
[zip] =>
[country] => Select Country
)
)
[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] => 1354299649
[TxnID] => WL-1-1340726008
)
[1340896239] => stdClass Object
(
[Level_ID] => 1340896239
[Name] => Test Level 2
[Cancelled] =>
[CancelDate] =>
[Pending] =>
[UnConfirmed] =>
[Expired] =>
[ExpiryDate] =>
[Active] => 1
[Status] => Array
(
[0] => Active
)
[Timestamp] => 1354299023
[TxnID] => WL-1-1340896239
)
[1340896250] => stdClass Object
(
[Level_ID] => 1340896250
[Name] => Test Level 3
[Cancelled] =>
[CancelDate] =>
[Pending] =>
[UnConfirmed] =>
[Expired] =>
[ExpiryDate] =>
[Active] => 1
[Status] => Array
(
[0] => Active
)
[Timestamp] => 1355159414
[TxnID] => WL-1-1340896250
)
)
)
)
[supported_verbs] => Array
(
[0] => GET
[1] => PUT
[2] => DELETE
)
)
Notes
This functions returns WLMAPIMethods::update_member($args) in core/api-helper/class-api-methods.php
