diff --git a/lib/Config/Populator.php b/lib/Config/Populator.php index 9150ad639e..43db70790a 100644 --- a/lib/Config/Populator.php +++ b/lib/Config/Populator.php @@ -194,6 +194,15 @@ class Populator { ]); } + $stats_notifications = Setting::getValue('stats_notifications'); + if(empty($stats_notifications)) { + $sender = Setting::getValue('sender', []); + Setting::setValue('stats_notifications', [ + 'enabled' => true, + 'address' => isset($sender['address'])? $sender['address'] : null, + ]); + } + // reset mailer log MailerLog::resetMailerLog(); } diff --git a/views/settings.html b/views/settings.html index af307c6f3c..0f177877f1 100644 --- a/views/settings.html +++ b/views/settings.html @@ -98,6 +98,17 @@ } else { $('#settings_subscriber_email_notification_error').hide(); } + console.log("whatever"); + // if new subscriber notification is enabled but sender is empty, show error + var stats_notifications_enabled = $('input[name="stats_notifications[enabled]"]:checked').val(), + stats_notifications_address = $('input[name="stats_notifications[address]"]').val().trim(); + if (stats_notifications_enabled && stats_notifications_address == '') { + $('#settings_stats_notifications_error').show(); + window.location.href = '#basics'; + errorFound = true; + } else { + $('#settings_stats_notifications_error').hide(); + } // stop processing if an error was found if (errorFound) { return false; @@ -182,6 +193,7 @@ $('#settings_re_captcha_tokens_error').hide(); $('#settings_subscriber_email_notification_error').hide(); + $('#settings_stats_notifications_error').hide(); function toggleLinuxCronSettings() { if ($('input[name="cron_trigger[method]"]:checked').val() === '<%= cron_trigger.linux_cron %>') { diff --git a/views/settings/basics.html b/views/settings/basics.html index 6442df58d9..626374f283 100644 --- a/views/settings/basics.html +++ b/views/settings/basics.html @@ -281,6 +281,48 @@ + +
+ <%= __('Enter the email address that should receive your newsletter’s stats 24 hours after it has been sent.') %> +
+
+
+
+
+
+
+