mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
MDL-6236 user editing - Default language not used instead of nonexisting one in user lang field - first lang chosen instead; merged from MODOLE_18_STABLE
This commit is contained in:
parent
59465949fa
commit
1545d7f0d4
@ -42,6 +42,16 @@ class user_edit_form extends moodleform {
|
||||
$mform =& $this->_form;
|
||||
$userid = $mform->getElementValue('id');
|
||||
|
||||
// if language does not exist, use site default lang
|
||||
if ($langsel = $mform->getElementValue('lang')) {
|
||||
$lang = reset($langsel);
|
||||
if (!file_exists($CFG->dataroot.'/lang/'.$lang) and
|
||||
!file_exists($CFG->dirroot .'/lang/'.$lang)) {
|
||||
$lang_el =& $mform->getElement('lang');
|
||||
$lang_el->setValue($CFG->lang);
|
||||
}
|
||||
}
|
||||
|
||||
if ($user = get_record('user', 'id', $userid)) {
|
||||
|
||||
// print picture
|
||||
|
@ -55,6 +55,16 @@ class user_editadvanced_form extends moodleform {
|
||||
$userid = $mform->getElementValue('id');
|
||||
$user = get_record('user', 'id', $userid);
|
||||
|
||||
// if language does not exist, use site default lang
|
||||
if ($langsel = $mform->getElementValue('lang')) {
|
||||
$lang = reset($langsel);
|
||||
if (!file_exists($CFG->dataroot.'/lang/'.$lang) and
|
||||
!file_exists($CFG->dirroot .'/lang/'.$lang)) {
|
||||
$lang_el =& $mform->getElement('lang');
|
||||
$lang_el->setValue($CFG->lang);
|
||||
}
|
||||
}
|
||||
|
||||
// user can not change own auth method
|
||||
if ($userid == $USER->id) {
|
||||
$mform->hardFreeze('auth');
|
||||
|
Loading…
x
Reference in New Issue
Block a user