Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mailing Unsubscribe Form: Show if email is already unsubscribed #21174

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CRM/Mailing/Form/Unsubscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function preProcess() {
$this->_job_id = $job_id = CRM_Utils_Request::retrieve('jid', 'Integer', $this);
$this->_queue_id = $queue_id = CRM_Utils_Request::retrieve('qid', 'Integer', $this);
$this->_hash = $hash = CRM_Utils_Request::retrieve('h', 'String', $this);
$isConfirm = CRM_Utils_Request::retrieveValue('confirm', 'Boolean', FALSE, FALSE, 'GET');

if (!$job_id || !$queue_id || !$hash) {
throw new CRM_Core_Exception(ts('Missing Parameters'));
Expand All @@ -74,8 +75,8 @@ public function preProcess() {
$groupExist = TRUE;
}
}
if (!$groupExist) {
$statusMsg = ts('%1 has been unsubscribed.', [1 => $email]);
if (!$groupExist && !$isConfirm) {
$statusMsg = ts('%1 has already been unsubscribed.', [1 => $email]);
CRM_Core_Session::setStatus($statusMsg, '', 'error');
}
$this->assign('groupExist', $groupExist);
Expand Down Expand Up @@ -112,7 +113,7 @@ public function postProcess() {
CRM_Mailing_Event_BAO_Unsubscribe::send_unsub_response($this->_queue_id, $groups, FALSE, $this->_job_id);
}

$statusMsg = ts('%1 is unsubscribed.', [1 => CRM_Utils_String::maskEmail($this->_email)]);
$statusMsg = ts('%1 has been unsubscribed successfully.', [1 => $this->_email]);
CRM_Core_Session::setStatus($statusMsg, '', 'success');
}

Expand Down