From 99d0c43c3466e42a0c643882bf5ff55405d4e855 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 15 May 2024 11:11:05 +0100 Subject: [PATCH] Improve the action_author renderer method --- renderer.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/renderer.php b/renderer.php index 4bc0a82b..1e4569db 100644 --- a/renderer.php +++ b/renderer.php @@ -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']); } /**