Progamatically subscribe / unsbscribe to list
-
Hi there,
I’ve been digging into your module for a little while and really enjoy it, the way it integrated into wordpress is just awesome !
Now I would like to programmatically subscribe/unsubscribe user to lists.
According to your documentation , there is no need for the API extension to use theTNP class
, which should perfectly fit my needs.I’ve thus tried a code example you provide with partial success. Indeed this code copied for the above linked documentation page,
TNP::subscribe(['email'=>'[email protected]', 'name'=>'My name', 'gender'=>'f', 'lists' => [2,12]]);
do indeed add a subscriber with its name and email, but not add it to any list.I’ve tried to simply the code like this
TNP::subscribe(['email'=>'[email protected]', 'lists' => [1]]);
but withut success.In the same vein, I’ve tried to unsubscribe a user from a list like this
TNP::unsubscribe(['email'=>'[email protected]', 'lists' => [1]]);
. This happens to change the subscriber statute fromconfirmed
toun-subscribed
on the subscriber general tab, but do not change its subscription to a given list.
Also, , I manually added a subscriber to a list, and then trigged this later snippet, and the behaviour is exactly the same as above.Ok I’ve noted that you now have a API V2, but I’m more confortable using the TNP class.
Could you please help me sort that with the TNP class, or provide me a very basic example of usage of the new API (I’m fine for creating an api key), but would really appreciate an example of usage in a php file.
Thank’s in advance for your support
Regards
- The topic ‘Progamatically subscribe / unsbscribe to list’ is closed to new replies.