PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Controllers/CampaignsController.php +13 -12 11.0.0 → 11.1.0 View file →
@@ -2,8 +2,9 @@
2 2
3 3 namespace AcyMailing\Controllers;
4 4
5 5 use AcyMailing\Classes\CampaignClass;
6 +use AcyMailing\Classes\HistoryClass;
6 7 use AcyMailing\Classes\MailClass;
7 8 use AcyMailing\Classes\ListClass;
8 9 use AcyMailing\Classes\UserClass;
9 10 use AcyMailing\Helpers\MailerHelper;
@@ -136,9 +137,8 @@
136 137 acym_sendAjaxResponse(acym_translation('ACYM_ACCESS_DENIED'), [], false);
137 138 }
138 139
139 140 $mailerHelper = new MailerHelper();
140 - $mailerHelper->autoAddUser = true;
141 141 $mailerHelper->report = false;
142 142 if (!empty($specificMailId)) {
143 143 $mailerHelper->isAbTest = $campaignClass->isAbTestMail($specificMailId);
144 144 }
@@ -168,22 +168,21 @@
168 168
169 169 return;
170 170 }
171 171
172 + $historyClass = new HistoryClass();
173 +
172 174 foreach ($testEmails as $oneAddress) {
175 + if (is_numeric($oneAddress)) {
176 + $receiver = $userClass->getOneById($oneAddress);
177 + } else {
178 + $receiver = $userClass->getOneByEmail($oneAddress, true);
179 + }
180 +
173 181 $mailId = $specificMailId;
174 182 if (empty($mailId)) {
175 183 if (acym_isMultilingual()) {
176 - if (is_numeric($oneAddress)) {
177 - $user = $userClass->getOneById($oneAddress);
178 - } else {
179 - $user = $userClass->getOneByEmail($oneAddress);
180 - }
181 - if (empty($user)) {
182 - $mailId = $campaign->mail_id;
183 - } else {
184 - $mailId = empty($translatedMails[$user->language]) ? $campaign->mail_id : $translatedMails[$user->language]->id;
185 - }
184 + $mailId = empty($receiver) || empty($translatedMails[$receiver->language]) ? $campaign->mail_id : $translatedMails[$receiver->language]->id;
186 185 } else {
187 186 $mailId = $campaign->mail_id;
188 187 }
189 188 }
@@ -191,9 +190,11 @@
191 190 $options = [
192 191 'isTest' => true,
193 192 'testNote' => $testNote,
194 193 ];
195 - if (!$mailerHelper->sendOne($mailId, $oneAddress, $options)) {
194 + if ($mailerHelper->sendOne($mailId, $receiver, $options)) {
195 + $historyClass->insert($receiver->id, 'test_sent', [], $mailId);
196 + } else {
196 197 $success = false;
197 198 }
198 199
199 200 if (!empty($mailerHelper->reportMessage)) {