Skip to content

Commit

Permalink
Force the language before formatting the notification.
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanna-lmsace committed Oct 7, 2023
1 parent 9ad00d6 commit 7d37056
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion classes/task/sendinvitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,21 @@ public function send_pulse($users, $pulse, $course, $context) {
// Rewrite the plugin file placeholders in the email text.
$messagehtml = file_rewrite_pluginfile_urls($messagehtml, 'pluginfile.php',
$context->id, 'mod_pulse', $filearea, 0);

// Set current student as user, filtercodes plugin uses current User data.
\core\session\manager::set_user($student);
if (isset($student->lang)) {
$oldforcelang = force_current_language($student->lang); // Force the session lang to user lang.
}
// Format filter supports. filter the enabled filters.
$subject = format_text($subject, FORMAT_HTML);
$messagehtml = format_text($messagehtml, FORMAT_HTML);

$messageplain = html_to_text($messagehtml); // Plain text.
// After format the message and subject return back to previous lang.
if (isset($oldforcelang)) {
force_current_language($oldforcelang);
}

// Send message to user.
pulse_mtrace("Sending pulse to the user ". fullname($userto) ."\n" );

Expand Down

0 comments on commit 7d37056

Please sign in to comment.