MDL-61658 user: Fix displaying of user's country name
authorDavid Mudrák <david@moodle.com>
Thu, 15 Mar 2018 12:17:31 +0000 (13:17 +0100)
committerDavid Mudrák <david@moodle.com>
Wed, 21 Mar 2018 17:17:47 +0000 (18:17 +0100)
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.

admin/user.php
blocks/myprofile/block_myprofile.php
user/classes/participants_table.php

index ac0f5f9..80e462d 100644 (file)
 
     } 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');
         }
index fa9c166..b596f15 100644 (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];
index 09f9246..e05e0fd 100644 (file)
@@ -229,7 +229,7 @@ class participants_table extends \table_sql {
         $this->enrolid = $enrolid;
         $this->status = $status;
         $this->selectall = $selectall;
-        $this->countries = get_string_manager()->get_list_of_countries();
+        $this->countries = get_string_manager()->get_list_of_countries(true);
         $this->extrafields = $extrafields;
         $this->context = $context;
         if ($canseegroups) {