Add stats notifications settings
[MAILPOET-1571]
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
@@ -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 %>') {
|
||||
|
@@ -281,6 +281,48 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Stats notifications -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="subscription_unsubscribe_page">
|
||||
<%= _x('Stats notifications', 'name of a setting to automatically send statistics (newsletter open rate, click rate, etc) by email') %>
|
||||
</label>
|
||||
<p class="description">
|
||||
<%= __('Enter the email address that should receive your newsletter’s stats 24 hours after it has been sent.') %>
|
||||
<td>
|
||||
<p>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="stats_notifications[enabled]"
|
||||
value="1"
|
||||
<% if(settings.stats_notifications.enabled) %>
|
||||
checked
|
||||
<% endif %>
|
||||
/><%= __('Yes') %>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="stats_notifications[enabled]"
|
||||
value=""
|
||||
<% if not(settings.stats_notifications.enabled) %>
|
||||
checked
|
||||
<% endif %>
|
||||
><%= __('No') %>
|
||||
</label>
|
||||
<br>
|
||||
<input type="email"
|
||||
id="stats_notifications[address]"
|
||||
name="stats_notifications[address]"
|
||||
value="<%= settings.stats_notifications.address %>"
|
||||
placeholder="me@mydomain.com" >
|
||||
<br>
|
||||
<div id="settings_stats_notifications_error" class="mailpoet_error_item mailpoet_error">
|
||||
<%= __('Please fill the email address.') %>
|
||||
</div>
|
||||
|
||||
<!-- New subscriber emails notifications -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
@@ -322,6 +364,7 @@
|
||||
<div id="settings_subscriber_email_notification_error" class="mailpoet_error_item mailpoet_error">
|
||||
<%= __('Please fill the email address.') %>
|
||||
</div>
|
||||
|
||||
<!-- shortcode: archive page -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
|
Reference in New Issue
Block a user