From ea16dc7925d889e9a4a576077b5df0dfb84cf5c0 Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Mon, 7 Sep 2020 16:18:22 +0200 Subject: [PATCH] Hotfix groups filter for subscribers listing [MAILPOET-3132] --- lib/Models/Subscriber.php | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lib/Models/Subscriber.php b/lib/Models/Subscriber.php index 97f2020907..96768be9f5 100644 --- a/lib/Models/Subscriber.php +++ b/lib/Models/Subscriber.php @@ -790,6 +790,46 @@ class Subscriber extends Model { ->findArray(); } + public static function groups($data) { + return [ + [ + 'name' => 'all', + 'label' => WPFunctions::get()->__('All', 'mailpoet'), + 'count' => self::getPublished()->count(), + ], + [ + 'name' => self::STATUS_SUBSCRIBED, + 'label' => WPFunctions::get()->__('Subscribed', 'mailpoet'), + 'count' => self::filter(self::STATUS_SUBSCRIBED)->count(), + ], + [ + 'name' => self::STATUS_UNCONFIRMED, + 'label' => WPFunctions::get()->__('Unconfirmed', 'mailpoet'), + 'count' => self::filter(self::STATUS_UNCONFIRMED)->count(), + ], + [ + 'name' => self::STATUS_UNSUBSCRIBED, + 'label' => WPFunctions::get()->__('Unsubscribed', 'mailpoet'), + 'count' => self::filter(self::STATUS_UNSUBSCRIBED)->count(), + ], + [ + 'name' => self::STATUS_INACTIVE, + 'label' => WPFunctions::get()->__('Inactive', 'mailpoet'), + 'count' => self::filter(self::STATUS_INACTIVE)->count(), + ], + [ + 'name' => self::STATUS_BOUNCED, + 'label' => WPFunctions::get()->__('Bounced', 'mailpoet'), + 'count' => self::filter(self::STATUS_BOUNCED)->count(), + ], + [ + 'name' => 'trash', + 'label' => WPFunctions::get()->__('Trash', 'mailpoet'), + 'count' => self::getTrashed()->count(), + ], + ]; + } + /** * This method is here only for BC fix of 3rd party plugin integration. * @see https://kb.mailpoet.com/article/195-add-subscribers-through-your-own-form-or-plugin