Skip to content

Commit

Permalink
MDL-51427 user: correctly use strings for phone1 and phone2
Browse files Browse the repository at this point in the history
Thanks to Olumuyiwa Taiwo for original patch

AMOS BEGIN
  CPY [phone,core],[phone1,core]
AMOS END
  • Loading branch information
marinaglancy committed Sep 16, 2015
1 parent f495510 commit 70fb46c
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 15 deletions.
2 changes: 0 additions & 2 deletions admin/auth_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion admin/settings/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
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'),
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/uploaduser/user_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function definition () {
$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');

Expand Down
4 changes: 2 additions & 2 deletions blocks/myprofile/block_myprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ public function get_content() {

if(!empty($this->config->display_phone1) && !empty($USER->phone1)) {
$this->content->text .= '<div class="myprofileitem phone1">';
$this->content->text .= get_string('phone').': ' . s($USER->phone1);
$this->content->text .= get_string('phone1').': ' . s($USER->phone1);
$this->content->text .= '</div>';
}

if(!empty($this->config->display_phone2) && !empty($USER->phone2)) {
$this->content->text .= '<div class="myprofileitem phone2">';
$this->content->text .= get_string('phone').': ' . s($USER->phone2);
$this->content->text .= get_string('phone2').': ' . s($USER->phone2);
$this->content->text .= '</div>';
}

Expand Down
4 changes: 2 additions & 2 deletions blocks/myprofile/lang/en/block_myprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
$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';
Expand Down
1 change: 1 addition & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,7 @@
$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}';
Expand Down
3 changes: 0 additions & 3 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/myprofilelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions mod/url/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion user/editlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"');
Expand Down

0 comments on commit 70fb46c

Please sign in to comment.