Version: current

# Class NewsletterRole

NewsletterRole provides extensions to the `Member` class, with new database fields and functions specific to the newsletter module.

  Extension
  DataObjectDecorator
  NewsletterRole

Package: newsletter
Located at newsletter/code/NewsletterRole.php

## Methods summary

`public array` | # `extraStatics( )` Define extra database fields Define extra database fields Return a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined. #### Returns `array` Returns a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined. #### Overrides `DataObjectDecorator::extraStatics`
`public` | # `updateCMSFields( `FieldSet` $fields )` Update the CMS fields specifically for Member decorated by this NewsletterRole decorator. Update the CMS fields specifically for Member decorated by this NewsletterRole decorator. #### Parameters $fields FieldSet $fields CMS fields to update #### Overrides `DataObjectDecorator::updateCMSFields`
`public` | # `updateMemberFormFields( `FieldSet` $fields )` Update the frontend fields specifically for Member decorated by this NewsletterRole decorator. Update the frontend fields specifically for Member decorated by this NewsletterRole decorator. #### Parameters $fields FieldSet $fields Frontend fields to update
`public `Member_Validator`` | # `getNewsletterSubscriptions( )` Factory method for the member validator. Factory method for the member validator. #### Returns ``Member_Validator`` Returns an instance of a `Member_Validator` object. #### TODO It's unclear where this is used.
`public` | # `unsubscribeFromNewsletter( `NewsletterType` $newsletterType )` Unsubscribe the current `Member` from a newsletter. Unsubscribe the current `Member` from a newsletter. #### Parameters $newsletterType NewsletterType $newsletterType Newsletter type to unsubscribe from #### TODO It's unclear where this is used.
`public` | # `saveNewsletterSubscriptions( mixed $groups )` This does some cunning and automatically save the newsletter subscriptions by adding and removing the member from the appropriate groups based on a checkboxset field. This function is called by the form handler whenever form->saveInto($member); is called with an checkboxsetfield in the data with the name "newsletterSubscriptions" This does some cunning and automatically save the newsletter subscriptions by adding and removing the member from the appropriate groups based on a checkboxset field. This function is called by the form handler whenever form->saveInto($member); is called with an checkboxsetfield in the data with the name "newsletterSubscriptions"
`public` | # `removeAllNewsletterSubscriptions( )`
`public` | # `setBlacklistedEmail( boolean $val )` Add the members email address to the blacklist 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. #### Parameters $val bool $val Set to TRUE if the address should be added to the blacklist, otherwise to FALSE.

### Methods inherited from DataObjectDecorator

`augmentDatabase()`, `augmentSQL()`, `augmentWrite()`, `can()`, `canCreate()`, `canDelete()`, `canEdit()`, `flushCache()`, `load_extra_statics()`, `onAfterDelete()`, `onAfterWrite()`, `onBeforeDelete()`, `onBeforeWrite()`, `populateDefaults()`, `requireDefaultRecords()`, `updateCMSActions()`, `updateFieldLabels()`, `updateFrontEndFields()`, `updateSummaryFields()`

### Methods inherited from Extension

`__construct()`, `clearOwner()`, `getOwner()`, `get_classname_without_arguments()`, `setOwner()`

### Magic methods summary

## Properties summary

### Properties inherited from DataObjectDecorator

`$decoratable_statics`

### Properties inherited from Extension

`$allowed_actions`, `$class`, `$owner`, `$ownerBaseClass`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -