• wenkunst

    (@wenkunst)


    I’m trying to use the API to unsubscribe users from a list using this example:

    $subscriber = "[email protected]"; // you can also pass a subscriber ID
    $list = 1; // you can get available list IDs by using the \MailPoet\API\API::MP('v1')->getLists(); method
    
    try {
      $subscriber = \MailPoet\API\API::MP('v1')->unsubscribeFromList($subscriber, $list); 
    } catch(Exception $exception) {
      // return $exception->getMessage();
    }

    The user gets removed from the list but the status keeps ‘subscribed’ in stead of ‘unsubscribed’. How can I change that?

    MailPoet version: 3.12.1
    Wordpress: 4.9.8

    • This topic was modified 6 years ago by wenkunst.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Wysija

    (@wysija)

    Hi there @wenkunst,

    That should be working. Make sure it’s running in your custom plugin and try output the variable using var_dump to find out if the $subscriber variable contains what you expect.

    Thanks!

    Thread Starter wenkunst

    (@wenkunst)

    Thanx for the response. My client doesn’t need the feature anymore so I don’t need to get this working.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unsubscribe from list with API doesn’t change status’ is closed to new replies.