Back to Documentation OverviewlistUpdateMember
public static listUpdateMember(string uid, string id, string email_address, array merge_vars, string email_type, boolean replace_interests)
Edit the email address, merge fields, and interest groups for a list member
- Section:
- List Related
- Parameters:
| uid | the id for your user account. Get by calling login($user, $pass) |
| id | the list id to connect to |
| email_address | the current email address of the member to update |
| merge_vars | array of new field values to update the member with. Use "EMAIL" to update the email address and "INTERESTS" to update the interest groups |
| email_type | change the email type preference for the member ("html" or "text"). Leave blank to keep the existing preference (optional) |
| replace_interests | flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member's interest groups (optional, defaults to true) |
- Returns:
- boolean - true on success, false on failure. When using MCAPI.class.php, the value can be tested and error messages pulled from the MCAPI object
Examples (1)[1] mcapi_listUpdateMember.php<?php /** This Example shows how to update a List Member's information using the MCAPI.php class and do some basic error checking. **/ // Include the MailChimp API code. Do Not Edit This! include('inc/MCAPI.class.php'); include('config.inc'); //username & pass // Connect to the MailChimp server with the user's credentials. $acct = new MCAPI($mailChimpUser, $mailChimpPass); $arrMergVars = array("FNAME"=>'Richard', "LNAME"=>'Wright'); $email = "richard@wright.com"; $retval = $acct->listUpdateMember($listId, $email, $arrMergVars,'html', false); if (!$retval){ echo "Unable to update member info!\n"; echo "\tCode=".$acct->errorCode."\n"; echo "\tMsg=".$acct->errorMessage."\n"; } else { //do something useful! } ?>
|