diff --git a/admin/settings/users.php b/admin/settings/users.php index 208556bfb2e..92c483af2ee 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -240,7 +240,8 @@ if ($hassiteconfig if ($field->param2 > 255 || $field->datatype != 'text') { continue; } - $fields['profile_field_' . $field->shortname] = $field->name . ' *'; + $fields['profile_field_' . $field->shortname] = format_string($field->name, true, + ['context' => context_system::instance()]) . ' *'; } return $fields; diff --git a/badges/criteria/award_criteria_profile.php b/badges/criteria/award_criteria_profile.php index d1f30961535..a8910e29f63 100644 --- a/badges/criteria/award_criteria_profile.php +++ b/badges/criteria/award_criteria_profile.php @@ -117,7 +117,8 @@ class award_criteria_profile extends award_criteria { if (in_array($field->id, $existing)) { $checked = true; } - $this->config_options($mform, array('id' => $field->id, 'checked' => $checked, 'name' => $field->name, 'error' => false)); + $this->config_options($mform, array('id' => $field->id, 'checked' => $checked, + 'name' => format_string($field->name), 'error' => false)); $none = false; } } diff --git a/lib/tests/behat/showuseridentity.feature b/lib/tests/behat/showuseridentity.feature index 53446924a3d..277a00b7cb2 100644 --- a/lib/tests/behat/showuseridentity.feature +++ b/lib/tests/behat/showuseridentity.feature @@ -32,6 +32,19 @@ Feature: Select user identity fields And I press "Save changes" And the field "Speciality" matches value "1" + Scenario: The admin settings screen correctly formats custom field names + Given the "multilang" filter is "on" + And the "multilang" filter applies to "content and headings" + And the following "custom profile field" exists: + | datatype | text | + | name | Field (EN)Field (DE) | + | shortname | stuff | + | param2 | 100 | + When I log in as "admin" + And I navigate to "Users > Permissions > User policies" in site administration + Then I should see "Field (EN)" in the "#admin-showuseridentity" "css_element" + And I should not see "Field (DE)" in the "#admin-showuseridentity" "css_element" + Scenario: When you choose custom fields, these should be displayed in the 'Browse list of users' screen Given the following config values are set as admin: | showuseridentity | username,department,profile_field_speciality |