From cbee8815fcad7f96df11e533e2907773ddcc63bb Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Fri, 29 Jan 2021 12:29:29 +0800 Subject: [PATCH] MDL-67959 mod_forum: Display group pictures in forum only if available Displaying a default group picture in forum posts leads to confusion, so better to not display a default group picture when the group picture is not set for the group. --- mod/forum/classes/local/exporters/author.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mod/forum/classes/local/exporters/author.php b/mod/forum/classes/local/exporters/author.php index 31352c09ba4..66f39dedc02 100644 --- a/mod/forum/classes/local/exporters/author.php +++ b/mod/forum/classes/local/exporters/author.php @@ -165,13 +165,11 @@ class author extends exporter { $groups = array_map(function($group) use ($urlfactory, $context, $output) { $imageurl = null; $groupurl = null; + if (!$group->hidepicture) { $imageurl = get_group_picture_url($group, $group->courseid, true); - if (empty($imageurl)) { - // Get a generic group image URL. - $imageurl = $output->image_url('g/g1'); - } } + if (course_can_view_participants($context)) { $groupurl = $urlfactory->get_author_group_url($group); }