Skip to content

Commit

Permalink
Improve the action_author renderer method
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed May 15, 2024
1 parent 6b52880 commit 99d0c43
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1922,13 +1922,13 @@ public function action_author(\stdClass $user, bool $canviewusername): string {
if ($user->deleted) {
return html_writer::div(get_string('deleteduser', 'mod_forum'));
}
$username = html_writer::link(new moodle_url('/user/view.php',
['id' => $user->id, 'course' => $this->page->course->id]),
fullname($user), ['class' => 'd-table-cell']);
if (!$canviewusername && $user->id !== $USER->id) {
$username = get_string('anonymous_user', 'mod_studentquiz');
return get_string('anonymous_user', 'mod_studentquiz');
}
return $username;

return html_writer::link(new moodle_url('/user/view.php',
['id' => $user->id, 'course' => $this->page->course->id]),
fullname($user), ['class' => 'd-table-cell']);
}

/**
Expand Down

0 comments on commit 99d0c43

Please sign in to comment.