From 88c9c42da23b5a2c5a1bc6e65c03cc11c0e4c885 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Sat, 20 Aug 2016 21:56:25 +0800 Subject: [PATCH] MDL-55654 user: apply format_string to field names --- user/profile/definelib.php | 8 +++----- user/profile/index.php | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/user/profile/definelib.php b/user/profile/definelib.php index fecf3159adb..a9a1a12c645 100644 --- a/user/profile/definelib.php +++ b/user/profile/definelib.php @@ -437,10 +437,8 @@ function profile_list_datatypes() { */ function profile_list_categories() { global $DB; - if (!$categories = $DB->get_records_menu('user_info_category', null, 'sortorder ASC', 'id, name')) { - $categories = array(); - } - return $categories; + $categories = $DB->get_records_menu('user_info_category', null, 'sortorder ASC', 'id, name'); + return array_map('format_string', $categories); } @@ -572,7 +570,7 @@ function profile_edit_field($id, $datatype, $redirect) { if (empty($id)) { $strheading = get_string('profilecreatenewfield', 'admin', $datatypes[$datatype]); } else { - $strheading = get_string('profileeditfield', 'admin', $field->name); + $strheading = get_string('profileeditfield', 'admin', format_string($field->name)); } // Print the page. diff --git a/user/profile/index.php b/user/profile/index.php index 92aa4911cbf..dd8cb046b83 100644 --- a/user/profile/index.php +++ b/user/profile/index.php @@ -81,7 +81,7 @@ switch ($action) { // Ask for confirmation, as there is user data available for field. $fieldname = $DB->get_field('user_info_field', 'name', array('id' => $id)); $optionsyes = array ('id' => $id, 'confirm' => 1, 'action' => 'deletefield', 'sesskey' => sesskey()); - $strheading = get_string('profiledeletefield', 'admin', $fieldname); + $strheading = get_string('profiledeletefield', 'admin', format_string($fieldname)); $PAGE->navbar->add($strheading); echo $OUTPUT->header(); echo $OUTPUT->heading($strheading);