Merge pull request #723 from mailpoet/bounced_subscribers

Add 'Bounced' status to subscribers [MAILPOET-684]
This commit is contained in:
Tautvidas Sipavičius
2016-11-29 12:47:41 +02:00
committed by GitHub
13 changed files with 89 additions and 8 deletions

View File

@ -13,6 +13,7 @@ class Subscriber extends Model {
const STATUS_SUBSCRIBED = 'subscribed';
const STATUS_UNSUBSCRIBED = 'unsubscribed';
const STATUS_UNCONFIRMED = 'unconfirmed';
const STATUS_BOUNCED = 'bounced';
const SUBSCRIPTION_LIMIT_COOLDOWN = 60;
@ -342,6 +343,11 @@ class Subscriber extends Model {
'label' => __('Unsubscribed', 'mailpoet'),
'count' => self::filter(self::STATUS_UNSUBSCRIBED)->count()
),
array(
'name' => self::STATUS_BOUNCED,
'label' => __('Bounced', 'mailpoet'),
'count' => self::filter(self::STATUS_BOUNCED)->count()
),
array(
'name' => 'trash',
'label' => __('Trash', 'mailpoet'),
@ -727,6 +733,12 @@ class Subscriber extends Model {
->where('status', self::STATUS_UNCONFIRMED);
}
static function bounced($orm) {
return $orm
->whereNull('deleted_at')
->where('status', self::STATUS_BOUNCED);
}
static function withoutSegments($orm) {
return $orm->select(MP_SUBSCRIBERS_TABLE.'.*')
->leftOuterJoin(