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.
This commit is contained in:
Jun Pataleta 2021-01-29 12:29:29 +08:00
parent fd840ab59c
commit cbee8815fc

View File

@ -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);
}