MDL-73138 group: remove double encoding of group/role names.

This commit is contained in:
Paul Holden 2023-03-21 12:01:55 +00:00
parent 16c5835a80
commit 017f8a9c4d
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
2 changed files with 6 additions and 5 deletions

View File

@ -95,7 +95,7 @@ switch ($action) {
foreach($groupmemberroles as $roleid=>$roledata) {
$shortroledata = new stdClass();
$shortroledata->name = $roledata->name;
$shortroledata->name = html_entity_decode($roledata->name, ENT_QUOTES, 'UTF-8');
$shortroledata->users = array();
foreach($roledata->users as $member) {
$shortmember = new stdClass();
@ -183,7 +183,7 @@ if ($groups) {
foreach ($groups as $group) {
$selected = false;
$usercount = $DB->count_records('groups_members', array('groupid' => $group->id));
$groupname = format_string($group->name) . ' (' . $usercount . ')';
$groupname = format_string($group->name, true, ['context' => $context, 'escape' => false]) . ' (' . $usercount . ')';
if (in_array($group->id, $groupids)) {
$selected = true;
if ($singlegroup) {
@ -234,8 +234,9 @@ if ($singlegroup) {
$users[] = $shortmember;
}
$members[] = (object)[
'role' => s($roledata->name),
'role' => html_entity_decode($roledata->name, ENT_QUOTES, 'UTF-8'),
'rolemembers' => $users
];
}

View File

@ -763,11 +763,11 @@ abstract class groups_user_selector_base extends user_selector_base {
foreach ($roles as $role) {
if ($search) {
$a = new stdClass;
$a->role = $role->name;
$a->role = html_entity_decode($role->name, ENT_QUOTES, 'UTF-8');
$a->search = $search;
$groupname = get_string('matchingsearchandrole', '', $a);
} else {
$groupname = $role->name;
$groupname = html_entity_decode($role->name, ENT_QUOTES, 'UTF-8');
}
$groupedusers[$groupname] = $role->users;
foreach ($groupedusers[$groupname] as &$user) {