Thanks in advance for reading. I'm building a member importer (rebuild of a busy site) but am having problems getting my members to import into my newsletter plugin. It handles the first one fine, but then just stops on the second. Recreated a stripped down version...
Code: Select all
<?php
$emails = array('test1@bigfishadwords.com', 'test2@bigfishadwords.com', 'test3@bigfishadwords.com');
foreach ($emails as $email) {
if (process_wnp_optin($email, 1)) {
echo 'Added: ' . $email . '<br>';
} else {
echo 'Not added: ' . $email . '<br>';
}
}
function process_wnp_optin($email, $list_id) {
global $Subscriber;
$wpMail = new wpMail();
$data = array('email' => $email, 'list_id' => array($list_id));
if ($Subscriber -> optin($data, true)) { return true; } else { return false; }
}
?>Code: Select all
$this -> data[$this -> model] = $this -> array_to_object($data);Anyway someone can help me out from this info? Happy to put in more of the code if needed, but I'm not that familiar with classes (though trying to break free from procedural), so maybe it's something simple like not creating a new wpMail object every time or something, though I've tested everything I can think of.
Any help is most appreciated. Day 3...
Thanks,
Philip