Single frequency setting; per-user override; footer line
Admin-facing simplification:
- Dropped separate \"lookahead\" and \"historical lookahead\" tree
prefs (and the once-per-month historical gate). A single
\"send every N days\" number now drives both the cron cadence
and the window each issue looks ahead for living + deceased
events.
- Default 14, range 1–90, applies uniformly.
User-facing addition:
- The /my-account/{tree} subscription card gained an \"Email
frequency\" select with options: use site default, weekly,
every 2 weeks, monthly, every 2 months, quarterly. Stored as
a per-tree-per-user preference.
- Dispatch now checks each recipient's own cadence against
their own last-sent timestamp. Admin-added external addresses
with no webtrees account always receive every run (no
per-user state).
- Newsletter footer now reads \"You can change how often you
receive this email, or unsubscribe entirely, in the Newsletter
subscription section on your My account page\" — true now
that the control exists.
German translations updated for the new strings; stale ones
removed.
This commit is contained in:
@@ -42,8 +42,6 @@ use Illuminate\Support\Collection;
|
||||
$id = $tree->id();
|
||||
$enabled = Configuration::isEnabled($tree);
|
||||
$frequency = Configuration::frequencyDays($tree);
|
||||
$lookahead = Configuration::lookaheadDays($tree);
|
||||
$histLook = Configuration::historicalLookaheadDays($tree);
|
||||
$annivs = Configuration::includeAnniversaries($tree);
|
||||
$subject = Configuration::subjectPrefix($tree);
|
||||
$extras = $tree->getPreference(Configuration::PREF_EXTRA_RECIPIENTS, '');
|
||||
@@ -81,22 +79,9 @@ use Illuminate\Support\Collection;
|
||||
max="<?= Configuration::MAX_FREQUENCY_DAYS ?>" required>
|
||||
<span class="input-group-text"><?= I18N::translate('days') ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="lookahead-<?= $id ?>">
|
||||
<?= I18N::translate('Look ahead') ?>
|
||||
</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group" style="max-width: 18rem;">
|
||||
<input class="form-control" type="number"
|
||||
id="lookahead-<?= $id ?>" name="lookahead-<?= $id ?>"
|
||||
value="<?= e((string) $lookahead) ?>"
|
||||
min="<?= Configuration::MIN_LOOKAHEAD_DAYS ?>"
|
||||
max="<?= Configuration::MAX_LOOKAHEAD_DAYS ?>" required>
|
||||
<span class="input-group-text"><?= I18N::translate('days') ?></span>
|
||||
</div>
|
||||
<small class="form-text text-muted">
|
||||
<?= I18N::translate('Each issue looks the same number of days ahead, for both living relatives and historical events of those who have passed away. Default 14.') ?>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -116,20 +101,6 @@ use Illuminate\Support\Collection;
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="historical-<?= $id ?>">
|
||||
<?= I18N::translate('Historical look-ahead (days)') ?>
|
||||
</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="number" style="max-width: 18rem;"
|
||||
id="historical-<?= $id ?>" name="historical-<?= $id ?>"
|
||||
value="<?= e((string) $histLook) ?>" min="7" max="60" required>
|
||||
<small class="form-text text-muted">
|
||||
<?= I18N::translate('Births and deaths of deceased people are included once per calendar month.') ?>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="lineal-<?= $id ?>">
|
||||
<?= I18N::translate('Detailed view distance') ?>
|
||||
|
||||
@@ -181,6 +181,32 @@ use Fisharebest\Webtrees\Tree;
|
||||
<div class="form-text">
|
||||
<?= I18N::translate('You will receive a periodic email with upcoming birthdays and other family events from %s.', e($tree->title())) ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$current_freq = Configuration::userFrequencyDays($tree, $user);
|
||||
$tree_freq = Configuration::frequencyDays($tree);
|
||||
$freq_labels = [
|
||||
0 => I18N::translate('Use site default (every %d days)', $tree_freq),
|
||||
7 => I18N::translate('Weekly'),
|
||||
14 => I18N::translate('Every 2 weeks'),
|
||||
30 => I18N::translate('Monthly'),
|
||||
60 => I18N::translate('Every 2 months'),
|
||||
90 => I18N::translate('Quarterly'),
|
||||
];
|
||||
?>
|
||||
<div class="mt-3">
|
||||
<label for="newsletter_frequency" class="form-label">
|
||||
<?= I18N::translate('Email frequency') ?>
|
||||
</label>
|
||||
<select class="form-select" id="newsletter_frequency"
|
||||
name="newsletter_frequency" style="max-width: 22rem;">
|
||||
<?php foreach ($freq_labels as $days => $label) : ?>
|
||||
<option value="<?= $days ?>" <?= $days === $current_freq ? 'selected' : '' ?>>
|
||||
<?= e($label) ?>
|
||||
</option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php endif ?>
|
||||
|
||||
@@ -16,9 +16,7 @@ use Illuminate\Support\Collection;
|
||||
* @var Collection<int,Fact>|null $anniversaries
|
||||
* @var Collection<int,Fact>|null $historical
|
||||
* @var bool $include_anniversaries
|
||||
* @var bool $include_historical
|
||||
* @var int $lookahead_days
|
||||
* @var int $historical_lookahead
|
||||
* @var int $window_days Shared lookahead window for living + deceased events
|
||||
* @var int $generated_at
|
||||
* @var array<string,string> $avatar_cids xref => CID name
|
||||
* @var array<string,string> $relationships xref => "your mother" etc. (per-recipient)
|
||||
@@ -597,7 +595,7 @@ $timeline_arrow_row = '<tr>'
|
||||
<div style="font-size:13px;font-weight:300;color:<?= $palette['ink3'] ?>;">
|
||||
<?= e($masthead_date($generated_at)) ?>
|
||||
<span style="color:<?= $palette['mute'] ?>;">·</span>
|
||||
<?= e(I18N::translate('Events in the next %d days.', $lookahead_days)) ?>
|
||||
<?= e(I18N::translate('Events in the next %d days.', $window_days)) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -706,7 +704,7 @@ $timeline_arrow_row = '<tr>'
|
||||
</td></tr>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($include_historical && $historical !== null && !$historical->isEmpty()) : ?>
|
||||
<?php if ($historical !== null && !$historical->isEmpty()) : ?>
|
||||
<?php
|
||||
$detailed = [];
|
||||
$summary = [];
|
||||
@@ -717,7 +715,7 @@ $timeline_arrow_row = '<tr>'
|
||||
<tr><td style="padding:32px 0 0;">
|
||||
<h2 style="<?= $section_title_style ?>"><?= e(I18N::translate('On this month in history')) ?></h2>
|
||||
<p style="<?= $section_kicker_style ?>">
|
||||
<?= e(I18N::translate('Events in the next %d days for people who have passed away.', $historical_lookahead)) ?>
|
||||
<?= e(I18N::translate('Events in the next %d days for people who have passed away.', $window_days)) ?>
|
||||
</p>
|
||||
<?php if ($detailed !== []) : ?>
|
||||
<?= $card_open ?>
|
||||
@@ -764,7 +762,7 @@ $timeline_arrow_row = '<tr>'
|
||||
<?= e(I18N::translate('You are receiving this email because you subscribed to the %s newsletter.', $tree->title())) ?>
|
||||
<br>
|
||||
<?= I18N::translate(
|
||||
'To change or cancel your subscription, edit the “Newsletter subscription” section on your %s page.',
|
||||
'You can change how often you receive this email, or unsubscribe entirely, in the “Newsletter subscription” section on your %s page.',
|
||||
'<a href="' . e($account_url) . '" style="color:' . $palette['link'] . ';text-decoration:none;border-bottom:1px solid ' . $palette['link'] . ';">' . e(I18N::translate('My account')) . '</a>',
|
||||
) ?>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user