Skip to content

Commit

Permalink
fixed: out of date notification elgg_echo's respect recipient language
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalsem committed Nov 14, 2024
1 parent b958a1d commit ce22adc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions classes/ColdTrick/StaticPages/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,15 @@ protected static function sendNotifications(array $notification_information): vo
continue;
}

$recipient_language = $user->getLanguage();

// build a list of all out-of-date pages
$list = '';

$new = (array) elgg_extract('new', $info, []);
if (!empty($new)) {
// add a header
$list .= elgg_echo('static:out_of_date:notification:section:new') . PHP_EOL;
$list .= elgg_echo('static:out_of_date:notification:section:new', [], $recipient_language) . PHP_EOL;

// list all pages
foreach ($new as $page_info) {
Expand All @@ -188,10 +190,10 @@ protected static function sendNotifications(array $notification_information): vo
// section header
if (elgg_language_key_exists("static:out_of_date:notification:section:reminder:{$reminder}")) {
// custom header
$list .= elgg_echo("static:out_of_date:notification:section:reminder:{$reminder}") . PHP_EOL;
$list .= elgg_echo("static:out_of_date:notification:section:reminder:{$reminder}", [], $recipient_language) . PHP_EOL;
} else {
// default header
$list .= elgg_echo('static:out_of_date:notification:section:reminder', [$reminder]) . PHP_EOL;
$list .= elgg_echo('static:out_of_date:notification:section:reminder', [$reminder], $recipient_language) . PHP_EOL;
}

// list all pages
Expand All @@ -206,13 +208,13 @@ protected static function sendNotifications(array $notification_information): vo
}

// build notification
$subject = elgg_echo('static:out_of_date:notification:subject');
$subject = elgg_echo('static:out_of_date:notification:subject', [], $recipient_language);
$message = elgg_echo('static:out_of_date:notification:message', [
$list,
elgg_generate_url('collection:object:static:user:out_of_date', [
'username' => $user->username,
]),
]);
], $recipient_language);

notify_user($user->guid, $site->guid, $subject, $message, [], 'email');
}
Expand Down

0 comments on commit ce22adc

Please sign in to comment.