public function Subscriber::isUnsubscribed in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Entity/Subscriber.php \Drupal\simplenews\Entity\Subscriber::isUnsubscribed()
- 3.x src/Entity/Subscriber.php \Drupal\simplenews\Entity\Subscriber::isUnsubscribed()
Check if the subscriber has an inactive subscription to a certain newsletter.
Parameters
string $newsletter_id: The ID of a newsletter.
Return value
bool Returns TRUE if the subscriber has the inactive subscription, otherwise FALSE.
Overrides SubscriberInterface::isUnsubscribed
File
- src/
Entity/ Subscriber.php, line 201
Class
- Subscriber
- Defines the simplenews subscriber entity.
Namespace
Drupal\simplenews\EntityCode
public function isUnsubscribed($newsletter_id) {
foreach ($this->subscriptions as $item) {
if ($item->target_id == $newsletter_id) {
return $item->status == SIMPLENEWS_SUBSCRIPTION_STATUS_UNSUBSCRIBED;
}
}
return FALSE;
}