« Back to Documentation Overview

listUpdateMember – v1.3

 listUpdateMember(string apikey, 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. If you are doing a batch update on lots of users, consider using listBatchSubscribe() with the update_existing and possible replace_interests parameter.

Section
List Related
mcapi_listUpdateMember.php
Parameters
apikey a valid API Key for your user account. Get by visiting your API dashboard
id the list id to connect to. Get by calling lists()
email_address the current email address of the member to update OR the "id" for the member returned from listMemberInfo, Webhooks, and Campaigns
merge_vars array of new field values to update the member with. See merge_vars in listSubscribe() for details.
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)

download example code

[1] mcapi_listUpdateMember.php

  1. <?php
  2. /**
  3. This Example shows how to update a List Member's information using the MCAPI.php
  4. class and do some basic error checking.
  5. **/
  6. require_once 'inc/MCAPI.class.php';
  7. require_once 'inc/config.inc.php'; //contains apikey
  8.  
  9. $api = new MCAPI($apikey);
  10.  
  11. $merge_vars = array("FNAME"=>'Richard', "LNAME"=>'Wright');
  12.  
  13. $retval = $api->listUpdateMember($listId, $my_email, $merge_vars, 'html', false);
  14.  
  15. if ($api->errorCode){
  16. echo "Unable to update member info!\n";
  17. echo "\tCode=".$api->errorCode."\n";
  18. echo "\tMsg=".$api->errorMessage."\n";
  19. } else {
  20. echo "Returned: ".$retval."\n";
  21. }
  22.  
  23. ?>
  24.