MDL-61658 user: Fix displaying of user's country name

In these cases we want to use the method get_list_of_countries() to
obtain translated names of all potential country codes. The country code
is already there in the database. So it does not matter if the country
is among those whitelisted in $CFG->allcountrycodes - we want to see its
name anyway.
This commit is contained in:
David Mudrák
2018-03-21 18:07:13 +01:00
parent bc4e9f628c
commit 041072f63c
3 changed files with 3 additions and 5 deletions
+1 -1
View File
@@ -252,7 +252,7 @@
} else {
$countries = get_string_manager()->get_list_of_countries(false);
$countries = get_string_manager()->get_list_of_countries(true);
if (empty($mnethosts)) {
$mnethosts = $DB->get_records('mnet_host', null, 'id', 'id,wwwroot,name');
}
+1 -1
View File
@@ -75,7 +75,7 @@ class block_myprofile extends block_base {
$this->content->text .= '<div class="myprofileitem fullname">'.fullname($USER).'</div>';
if(!isset($this->config->display_country) || $this->config->display_country == 1) {
$countries = get_string_manager()->get_list_of_countries();
$countries = get_string_manager()->get_list_of_countries(true);
if (isset($countries[$USER->country])) {
$this->content->text .= '<div class="myprofileitem country">';
$this->content->text .= get_string('country') . ': ' . $countries[$USER->country];
+1 -3
View File
@@ -112,7 +112,7 @@ user_list_view($course, $context);
$bulkoperations = has_capability('moodle/course:bulkmessaging', $context);
$countries = get_string_manager()->get_list_of_countries();
$countries = get_string_manager()->get_list_of_countries(true);
$strnever = get_string('never');
@@ -615,8 +615,6 @@ if ($mode === MODE_USERDETAILS) { // Print simple listing.
$context = context_course::instance($course->id);
$usercontext = context_user::instance($user->id);
$countries = get_string_manager()->get_list_of_countries();
// Get the hidden field list.
if (has_capability('moodle/course:viewhiddenuserfields', $context)) {
$hiddenfields = array();