From 70fb46c87f92e5232db484428aa6491ffc6a6cb8 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Wed, 16 Sep 2015 13:10:10 +0800 Subject: [PATCH] MDL-51427 user: correctly use strings for phone1 and phone2 Thanks to Olumuyiwa Taiwo for original patch AMOS BEGIN CPY [phone,core],[phone1,core] AMOS END --- admin/auth_config.php | 2 -- admin/settings/users.php | 2 +- admin/tool/uploaduser/user_form.php | 2 +- blocks/myprofile/block_myprofile.php | 4 ++-- blocks/myprofile/lang/en/block_myprofile.php | 4 ++-- lang/en/moodle.php | 1 + lib/moodlelib.php | 3 --- lib/myprofilelib.php | 2 +- mod/url/locallib.php | 4 ++-- user/editlib.php | 2 +- 10 files changed, 11 insertions(+), 15 deletions(-) diff --git a/admin/auth_config.php b/admin/auth_config.php index e1a0fb08c8c..b307cd7d5d9 100644 --- a/admin/auth_config.php +++ b/admin/auth_config.php @@ -146,8 +146,6 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts, // If custom field then pick name from database. $fieldshortname = str_replace('profile_field_', '', $fieldname); $fieldname = $customfieldname[$fieldshortname]->name; - } elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) { - $fieldname = get_string($matches[1]) . ' ' . $matches[2]; } elseif ($fieldname == 'url') { $fieldname = get_string('webpage'); } else { diff --git a/admin/settings/users.php b/admin/settings/users.php index b2c1d23764f..6bd0ea16035 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -185,7 +185,7 @@ if ($hassiteconfig new lang_string('showuseridentity_desc', 'admin'), array('email' => 1), array( 'idnumber' => new lang_string('idnumber'), 'email' => new lang_string('email'), - 'phone1' => new lang_string('phone'), + 'phone1' => new lang_string('phone1'), 'phone2' => new lang_string('phone2'), 'department' => new lang_string('department'), 'institution' => new lang_string('institution'), diff --git a/admin/tool/uploaduser/user_form.php b/admin/tool/uploaduser/user_form.php index 04bb24b3d56..218392ef2d2 100644 --- a/admin/tool/uploaduser/user_form.php +++ b/admin/tool/uploaduser/user_form.php @@ -290,7 +290,7 @@ class admin_uploaduser_form2 extends moodleform { $mform->setType('department', PARAM_TEXT); $mform->setDefault('department', $templateuser->department); - $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"'); + $mform->addElement('text', 'phone1', get_string('phone1'), 'maxlength="20" size="25"'); $mform->setType('phone1', PARAM_NOTAGS); $mform->setAdvanced('phone1'); diff --git a/blocks/myprofile/block_myprofile.php b/blocks/myprofile/block_myprofile.php index cd82a6eaf2e..fa9c1662e5b 100644 --- a/blocks/myprofile/block_myprofile.php +++ b/blocks/myprofile/block_myprofile.php @@ -127,13 +127,13 @@ class block_myprofile extends block_base { if(!empty($this->config->display_phone1) && !empty($USER->phone1)) { $this->content->text .= '
'; - $this->content->text .= get_string('phone').': ' . s($USER->phone1); + $this->content->text .= get_string('phone1').': ' . s($USER->phone1); $this->content->text .= '
'; } if(!empty($this->config->display_phone2) && !empty($USER->phone2)) { $this->content->text .= '
'; - $this->content->text .= get_string('phone').': ' . s($USER->phone2); + $this->content->text .= get_string('phone2').': ' . s($USER->phone2); $this->content->text .= '
'; } diff --git a/blocks/myprofile/lang/en/block_myprofile.php b/blocks/myprofile/lang/en/block_myprofile.php index 399fa105295..b220995fe35 100644 --- a/blocks/myprofile/lang/en/block_myprofile.php +++ b/blocks/myprofile/lang/en/block_myprofile.php @@ -34,8 +34,8 @@ $string['display_skype'] = 'Display Skype'; $string['display_yahoo'] = 'Display Yahoo'; $string['display_aim'] = 'Display AIM'; $string['display_msn'] = 'Display MSN'; -$string['display_phone1'] = 'Display phone number 1'; -$string['display_phone2'] = 'Display phone number 2'; +$string['display_phone1'] = 'Display phone'; +$string['display_phone2'] = 'Display mobile phone'; $string['display_institution'] = 'Display institution'; $string['display_address'] = 'Display address'; $string['display_firstaccess'] = 'Display first access'; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 4a6e3fcb091..4a06cda415e 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -1427,6 +1427,7 @@ $string['perpagea'] = 'Per page: {$a}'; $string['personal'] = 'Personal'; $string['personalprofile'] = 'Personal profile'; $string['phone'] = 'Phone'; +$string['phone1'] = 'Phone'; $string['phone2'] = 'Mobile phone'; $string['phpinfo'] = 'PHP info'; $string['pictureof'] = 'Picture of {$a}'; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 7d897560ea9..6a5a900d3e0 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -3547,9 +3547,6 @@ function get_extra_user_fields_sql($context, $alias='', $prefix='', $already = a function get_user_field_name($field) { // Some fields have language strings which are not the same as field name. switch ($field) { - case 'phone1' : { - return get_string('phone'); - } case 'url' : { return get_string('webpage'); } diff --git a/lib/myprofilelib.php b/lib/myprofilelib.php index a341fbf51c4..5d5b266dd48 100644 --- a/lib/myprofilelib.php +++ b/lib/myprofilelib.php @@ -175,7 +175,7 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, } if (isset($identityfields['phone1']) && $user->phone1) { - $node = new core_user\output\myprofile\node('contact', 'phone1', get_string('phone'), null, null, $user->phone1); + $node = new core_user\output\myprofile\node('contact', 'phone1', get_string('phone1'), null, null, $user->phone1); $tree->add_node($node); } diff --git a/mod/url/locallib.php b/mod/url/locallib.php index 591a29e17ad..593f6d7cbc6 100644 --- a/mod/url/locallib.php +++ b/mod/url/locallib.php @@ -421,8 +421,8 @@ function url_get_variable_options($config) { 'userfullname' => get_string('fullnameuser'), 'useremail' => get_string('email'), 'usericq' => get_string('icqnumber'), - 'userphone1' => get_string('phone').' 1', - 'userphone2' => get_string('phone2').' 2', + 'userphone1' => get_string('phone1'), + 'userphone2' => get_string('phone2'), 'userinstitution' => get_string('institution'), 'userdepartment' => get_string('department'), 'useraddress' => get_string('address'), diff --git a/user/editlib.php b/user/editlib.php index 836b12b1b62..e0c545011d4 100644 --- a/user/editlib.php +++ b/user/editlib.php @@ -430,7 +430,7 @@ function useredit_shared_definition(&$mform, $editoroptions, $filemanageroptions $mform->addElement('text', 'department', get_string('department'), 'maxlength="255" size="25"'); $mform->setType('department', PARAM_TEXT); - $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"'); + $mform->addElement('text', 'phone1', get_string('phone1'), 'maxlength="20" size="25"'); $mform->setType('phone1', PARAM_NOTAGS); $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"'); -- 2.43.0