You are here

public function MailchimpLists::addOrUpdateMember in Mailchimp 8

Same name in this branch
  1. 8 lib/mailchimp-api-php/src/MailchimpLists.php \Mailchimp\MailchimpLists::addOrUpdateMember()
  2. 8 lib/mailchimp-api-php/tests/src/MailchimpLists.php \Mailchimp\Tests\MailchimpLists::addOrUpdateMember()

Adds a new or update an existing member of a Mailchimp list.

Parameters

string $list_id: The ID of the list.

string $email: The member's email address.

array $parameters: Associative array of optional request parameters.

bool $batch: TRUE to create a new pending batch operation.

Return value

object

See also

http://developer.mailchimp.com/documentation/mailchimp/reference/lists/m...

1 call to MailchimpLists::addOrUpdateMember()
MailchimpLists::addOrUpdateMember in lib/mailchimp-api-php/tests/src/MailchimpLists.php
@inheritdoc
1 method overrides MailchimpLists::addOrUpdateMember()
MailchimpLists::addOrUpdateMember in lib/mailchimp-api-php/tests/src/MailchimpLists.php
@inheritdoc

File

lib/mailchimp-api-php/src/MailchimpLists.php, line 325

Class

MailchimpLists
Mailchimp Lists/Audiences library.

Namespace

Mailchimp

Code

public function addOrUpdateMember($list_id, $email, $parameters = [], $batch = FALSE) {
  $tokens = [
    'list_id' => $list_id,
    'subscriber_hash' => md5(strtolower($email)),
  ];
  $parameters += [
    'email_address' => $email,
  ];
  return $this
    ->request('PUT', '/lists/{list_id}/members/{subscriber_hash}', $tokens, $parameters, $batch);
}