Skip to content

Commit

Permalink
MDL-78971 quiz_grading: escape user identity fields on display.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden authored and Jenkins committed Oct 4, 2023
1 parent b19a93b commit aa8ab48
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mod/quiz/report/grading/report.php
Expand Up @@ -720,13 +720,15 @@ protected function get_question_heading(stdClass $attempt, bool $shownames, bool
$a = new stdClass();
$a->attempt = $attempt->attempt;
$a->fullname = fullname($attempt);

$customfields = [];
foreach ($this->extrauserfields as $field) {
if ($attempt->{s($field)}) {
$customfields[] = $attempt->{s($field)};
if (strval($attempt->{$field}) !== '') {
$customfields[] = s($attempt->{$field});
}
}
$a->customfields = trim(implode(', ', (array)$customfields), ' ,');

$a->customfields = implode(', ', $customfields);

if ($shownames && $showcustomfields) {
return get_string('gradingattemptwithcustomfields', 'quiz_grading', $a);
Expand Down

0 comments on commit aa8ab48

Please sign in to comment.