diff --git a/lib/Router/Endpoints/Subscription.php b/lib/Router/Endpoints/Subscription.php index 879fe64a23..e85410972e 100644 --- a/lib/Router/Endpoints/Subscription.php +++ b/lib/Router/Endpoints/Subscription.php @@ -14,6 +14,8 @@ class Subscription { const ACTION_MANAGE = 'manage'; const ACTION_UNSUBSCRIBE = 'unsubscribe'; const ACTION_CONFIRM_UNSUBSCRIBE = 'confirmUnsubscribe'; + const ACTION_RE_ENGAGEMENT = 'reEngagement'; + public $allowedActions = [ self::ACTION_CAPTCHA, self::ACTION_CAPTCHA_IMAGE, @@ -21,7 +23,9 @@ class Subscription { self::ACTION_MANAGE, self::ACTION_UNSUBSCRIBE, self::ACTION_CONFIRM_UNSUBSCRIBE, + self::ACTION_RE_ENGAGEMENT, ]; + public $permissions = [ 'global' => AccessControl::NO_ACCESS_RESTRICTION, ]; @@ -79,6 +83,10 @@ class Subscription { $subscription->unsubscribe(); } + public function reEngagement($data) { + $this->initSubscriptionPage(UserSubscription\Pages::ACTION_RE_ENGAGEMENT, $data); + } + private function initSubscriptionPage($action, $data) { return $this->subscriptionPages->init($action, $data, true, true); } diff --git a/lib/Subscription/Pages.php b/lib/Subscription/Pages.php index 2f44d2a32a..5ca5fa2c49 100644 --- a/lib/Subscription/Pages.php +++ b/lib/Subscription/Pages.php @@ -24,6 +24,7 @@ class Pages { const ACTION_CONFIRM_UNSUBSCRIBE = 'confirm_unsubscribe'; const ACTION_MANAGE = 'manage'; const ACTION_UNSUBSCRIBE = 'unsubscribe'; + const ACTION_RE_ENGAGEMENT = 're_engagement'; private $action; private $data; @@ -239,6 +240,9 @@ class Pages { case self::ACTION_UNSUBSCRIBE: return $this->getUnsubscribeTitle(); + + case self::ACTION_RE_ENGAGEMENT: + return $this->getReEngagementTitle(); } } } @@ -272,6 +276,9 @@ class Pages { case self::ACTION_UNSUBSCRIBE: $content = $this->getUnsubscribeContent(); break; + case self::ACTION_RE_ENGAGEMENT: + $content = $this->getReEngagementContent(); + break; } return str_replace('[mailpoet_page]', trim($content), $pageContent); } else { @@ -335,6 +342,12 @@ class Pages { } } + private function getReEngagementTitle() { + if ($this->isPreview() || $this->subscriber !== null) { + return __('Thank you for letting us know!', 'mailpoet'); + } + } + private function getConfirmUnsubscribeTitle() { if ($this->isPreview() || $this->subscriber !== null) { return $this->wp->__('Confirm you want to unsubscribe', 'mailpoet'); @@ -384,6 +397,14 @@ class Pages { return $content; } + private function getReEngagementContent() { + $content = ''; + if ($this->isPreview() || $this->subscriber !== null) { + $content .= '

' . __('We appreciate your continued interest in our updates. Expect to hear from us again soon!', 'mailpoet') . '

'; + } + return $content; + } + private function getConfirmUnsubscribeContent() { if (!$this->isPreview() && $this->subscriber === null) { return '';