diff --git a/main/admin/user_add.php b/main/admin/user_add.php index 3375c74f29..992e15655a 100644 --- a/main/admin/user_add.php +++ b/main/admin/user_add.php @@ -1,4 +1,4 @@ -addElement('select','status',get_lang('Status'),$status,'id="status_select" onchange="display_drh_list()"'); - +$form->addElement('select_language', 'language', get_lang('Language')); //drh list (display only if student) $display = $_POST['status'] == STUDENT || !isset($_POST['status']) ? 'block' : 'none'; $form->addElement('html','
'); @@ -332,6 +332,7 @@ if( $form->validate()) $phone = $user['phone']; $username = $user['username']; $status = intval($user['status']); + $language = $user['language']; $picture = $_FILES['picture']; $platform_admin = intval($user['admin']['platform_admin']); $send_mail = intval($user['mail']['send_mail']); @@ -356,7 +357,7 @@ if( $form->validate()) } $active = intval($user['active']); - $user_id = UserManager::create_user($firstname,$lastname,$status,$email,$username,$password,$official_code,api_get_setting('platformLanguage'),$phone,$picture_uri,$auth_source,$expiration_date,$active, $hr_dept_id); + $user_id = UserManager::create_user($firstname,$lastname,$status,$email,$username,$password,$official_code,$language,$phone,$picture_uri,$auth_source,$expiration_date,$active, $hr_dept_id); // picture path $picture_path = api_get_path(SYS_CODE_PATH).'upload/users/'.$user_id.'/'; diff --git a/main/inc/lib/formvalidator/Element/select_language.php b/main/inc/lib/formvalidator/Element/select_language.php index f95d06e9f5..f17f7955c8 100644 --- a/main/inc/lib/formvalidator/Element/select_language.php +++ b/main/inc/lib/formvalidator/Element/select_language.php @@ -1,5 +1,5 @@ _values = array(); foreach ($languages['name'] as $index => $name) { - $this->addOption($name,$languages['folder'][$index]); + if($languages['folder'][$index] == api_get_setting('platformLanguage')) { + $this->addOption($name,$languages['folder'][$index],array('selected'=>'selected')); + } else { + $this->addOption($name,$languages['folder'][$index]); + } } } }