Skip to content

Commit

Permalink
Dev If someone already has opted out, give that information right awa…
Browse files Browse the repository at this point in the history
…y, instead of asking to click a opt-out button
  • Loading branch information
c-schmitz committed Sep 23, 2021
1 parent 47c2f7e commit 3012540
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions application/controllers/OptoutController.php
Expand Up @@ -63,8 +63,13 @@ function actiontokens()
if ($aSurveyInfo == false || !tableExists("{{tokens_{$iSurveyID}}}")) {
throw new CHttpException(404, "The survey in which you are trying to participate does not seem to exist. It may have been deleted or the link you were given is outdated or incorrect.");
} else {
$sMessage = "<p>" . gT('Please confirm that you want to opt out of this survey by clicking the button below.') . '<br>' . gT("After confirmation you won't receive any invitations or reminders for this survey anymore.") . "</p>";
$sMessage .= '<p><a href="' . Yii::app()->createUrl('optout/removetokens', array('surveyid' => $iSurveyID, 'langcode' => $sBaseLanguage, 'token' => $sToken)) . '" class="btn btn-default btn-lg">' . gT("I confirm") . '</a><p>';
$oToken = Token::model($iSurveyID)->findByAttributes(array('token' => $sToken));
if (substr($oToken->emailstatus, 0, strlen('OptOut')) == 'OptOut') {
$sMessage = "<p>" . gT('You have already been removed from this survey.') . "</p>";
} else {
$sMessage = "<p>" . gT('Please confirm that you want to opt out of this survey by clicking the button below.') . '<br>' . gT("After confirmation you won't receive any invitations or reminders for this survey anymore.") . "</p>";
$sMessage .= '<p><a href="' . Yii::app()->createUrl('optout/removetokens', array('surveyid' => $iSurveyID, 'langcode' => $sBaseLanguage, 'token' => $sToken)) . '" class="btn btn-default btn-lg">' . gT("I confirm") . '</a><p>';
}
$this->renderHtml($sMessage, $aSurveyInfo, $iSurveyID);
}
}
Expand Down

0 comments on commit 3012540

Please sign in to comment.