mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Removed blacklist newsletter specific code out of core and into newsletter module
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@70809 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
04fa06a94e
commit
29db659e7d
@ -756,36 +756,4 @@ class Email_BounceRecord extends DataObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is responsible for ensuring that members who are on it receive NO email
|
||||
* communication at all. any correspondance is caught before the email is sent.
|
||||
* @package sapphire
|
||||
* @subpackage email
|
||||
*/
|
||||
class Email_BlackList extends DataObject{
|
||||
static $db = array(
|
||||
'BlockedEmail' => 'Varchar',
|
||||
);
|
||||
static $has_one = array(
|
||||
'Member' => 'Member'
|
||||
);
|
||||
|
||||
/**
|
||||
* Helper function to see if the email being
|
||||
* sent has specifically been blocked.
|
||||
*/
|
||||
static function isBlocked($email) {
|
||||
$blockedEmails = DataObject::get("Email_BlackList")->toDropDownMap("ID","BlockedEmail");
|
||||
if($blockedEmails){
|
||||
if(in_array($email,$blockedEmails)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -17,7 +17,6 @@ class Member extends DataObject {
|
||||
'Bounced' => 'Boolean', // Note: This does not seem to be used anywhere.
|
||||
'AutoLoginHash' => 'Varchar(30)',
|
||||
'AutoLoginExpired' => 'SSDatetime',
|
||||
'BlacklistedEmail' => 'Boolean',
|
||||
'PasswordEncryption' => "Enum('none', 'none')",
|
||||
'Salt' => 'Varchar(50)',
|
||||
'PasswordExpiry' => 'Date',
|
||||
@ -392,30 +391,6 @@ class Member extends DataObject {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the members email address to the blacklist
|
||||
*
|
||||
* With this method the blacklisted email table is updated to ensure that
|
||||
* no promotional material is sent to the member (newsletters).
|
||||
* Standard system messages are still sent such as receipts.
|
||||
*
|
||||
* @param bool $val Set to TRUE if the address should be added to the
|
||||
* blacklist, otherwise to FALSE.
|
||||
*/
|
||||
function setBlacklistedEmail($val) {
|
||||
if($val && $this->Email) {
|
||||
$blacklisting = new Email_BlackList();
|
||||
$blacklisting->BlockedEmail = $this->Email;
|
||||
$blacklisting->MemberID = $this->ID;
|
||||
$blacklisting->write();
|
||||
}
|
||||
|
||||
$this->setField("BlacklistedEmail", $val);
|
||||
// Save the BlacklistedEmail field to the Member table
|
||||
$this->write();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Generate a random password, with randomiser to kick in if there's no words file on the
|
||||
* filesystem.
|
||||
@ -860,10 +835,8 @@ class Member extends DataObject {
|
||||
$mainFields->removeByName('Salt');
|
||||
$mainFields->removeByName('NumVisit');
|
||||
$mainFields->removeByName('LastVisited');
|
||||
$mainFields->removeByName('BlacklistedEmail');
|
||||
|
||||
$fields->removeByName('Subscriptions');
|
||||
$fields->removeByName('UnsubscribedRecords');
|
||||
// Groups relation will get us into logical conflicts because
|
||||
// Members are displayed within group edit form in SecurityAdmin
|
||||
$fields->removeByName('Groups');
|
||||
|
Loading…
Reference in New Issue
Block a user