Commit 83df942b authored by Glen Peek's avatar Glen Peek

Add recipients to mailing list when a page has only one newsletter type associated with it

parent 5c6fb3d5
......@@ -442,19 +442,17 @@ JS
} else {
// if the page has associate with one newsletter type, it won't appear in front form, but the
// recipient needs to be added to the related mailling list.
if($this->MailingLists && ($listIDs = explode(",",$this->MailingLists))) {
foreach($listIDs as $listID){
$mailinglist = DataObject::get_by_id("MailingList", $listID);
if($mailinglist && $mailinglist->exists()){
//remove recipient from unsubscribe records if the recipient
// unsubscribed from mailing list before
//$this->removeUnsubscribe($mailingList,$recipient);
$mailinglists->push($mailinglist);
$recipient->MailingLists()->add($mailinglist);
}
}
}
if ($this->MailingLists()->Count() == 1) {
$mailinglist = $this->MailingLists()->first();
if ($mailinglist && $mailinglist->exists()) {
//remove recipient from unsubscribe records if the recipient
// unsubscribed from mailing list before
//$this->removeUnsubscribe($mailingList,$recipient);
$mailinglists->push($mailinglist);
$recipient->MailingLists()->add($mailinglist);
}
}
else {
user_error('No Newsletter type selected to subscribe to', E_USER_WARNING);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment