mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Added warnings for parts of Member that require the newsletter module. Note that this code should really be moved to the newsletter module at some stage.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60885 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
76797cc5e1
commit
b4c593e63d
@ -367,6 +367,11 @@ class Member extends DataObject {
|
|||||||
* "newsletterSubscriptions"
|
* "newsletterSubscriptions"
|
||||||
*/
|
*/
|
||||||
function saveNewsletterSubscriptions($groups){
|
function saveNewsletterSubscriptions($groups){
|
||||||
|
if(!class_exists('NewsletterType')) {
|
||||||
|
user_error("Member::saveNewsletterSubscriptions() called without the newsletter module available", E_USER_WARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$checkboxsetfield = new CheckboxSetField(
|
$checkboxsetfield = new CheckboxSetField(
|
||||||
"NewsletterSubscriptions",
|
"NewsletterSubscriptions",
|
||||||
"",
|
"",
|
||||||
@ -377,6 +382,11 @@ class Member extends DataObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeAllNewsletterSubscriptions(){
|
function removeAllNewsletterSubscriptions(){
|
||||||
|
if(!class_exists('NewsletterType')) {
|
||||||
|
user_error("Member::removeAllNewsletterSubscriptions() called without the newsletter module available", E_USER_WARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$groups = $this->Groups();
|
$groups = $this->Groups();
|
||||||
$groupIDs = $groups->getIDList();
|
$groupIDs = $groups->getIDList();
|
||||||
$newsletterTypes = DataObject::get("NewsletterType");
|
$newsletterTypes = DataObject::get("NewsletterType");
|
||||||
@ -918,6 +928,11 @@ class Member extends DataObject {
|
|||||||
* from
|
* from
|
||||||
*/
|
*/
|
||||||
function unsubscribeFromNewsletter(NewsletterType $newsletterType) {
|
function unsubscribeFromNewsletter(NewsletterType $newsletterType) {
|
||||||
|
if(!class_exists('NewsletterType')) {
|
||||||
|
user_error("Member::unsubscribeFromNewsletter() called without the newsletter module available", E_USER_WARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// record today's date in unsubscriptions
|
// record today's date in unsubscriptions
|
||||||
// this is a little bit redundant
|
// this is a little bit redundant
|
||||||
$unsubscribeRecord = new Member_UnsubscribeRecord();
|
$unsubscribeRecord = new Member_UnsubscribeRecord();
|
||||||
@ -1381,6 +1396,11 @@ class Member_UnsubscribeRecord extends DataObject {
|
|||||||
* @param int|NewsletterType $newsletterType Newsletter type object or ID
|
* @param int|NewsletterType $newsletterType Newsletter type object or ID
|
||||||
*/
|
*/
|
||||||
function unsubscribe($member, $newsletterType) {
|
function unsubscribe($member, $newsletterType) {
|
||||||
|
if(!class_exists('NewsletterType')) {
|
||||||
|
user_error("Member_UnsubscribeRecord::unsubscribe() called without the newsletter module available", E_USER_WARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// $this->UnsubscribeDate()->setVal( 'now' );
|
// $this->UnsubscribeDate()->setVal( 'now' );
|
||||||
$this->MemberID = (is_numeric($member))
|
$this->MemberID = (is_numeric($member))
|
||||||
? $member
|
? $member
|
||||||
|
Loading…
Reference in New Issue
Block a user