You can quickly add subscribers in Mailster with some line of code.
The quickest way is to add a single email address.
mailster( 'subscribers' )->add( '[email protected]' );
This method will return the id of the subscriber or a WP_Error object if something fails.
Add a Subscriber with additional info
If you have more info you can use an array as the first argument
$subscriber_id = mailster('subscribers')->add(array(
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[email protected]',
'status' => 1, //1 = subscribed (default) , 0 = pending, 2 = unsubscribed, 3 = hardbounced
'custom-field' => 'Custom Value',
'referer' => 'Your referer' //default = $_SERVER['REQUEST_URI']
), $overwrite );
Update a Subscriber
You need the subscriber id to update a subscriber.
mailster('subscribers')->update(array(
'ID' => 123,
'firstname' => 'Jane',
));
Assign lists
To assign lists you can use the assign_lists method like
$success = mailster('subscribers')->assign_lists($subscriber_ids, $lists, $remove_old);
$subscriber_ids
is either a single id or an array with id’s of subscribers
$lists
is either a single id or an array with id’s of lists
$remove_old
will remove all assigned lists before assigning the new once (default false)
$success
is boolean
Remove a Subscriber
To remove a subscriber you can do
mailster('subscribers')->remove( $subscriber_ids )
$subscriber_ids
can either be a single subscriber id or an array of ids.
Learn more about Mailster for Developers.