MDL-41847 core_user: Add preferred lang field to the user creation form
The preferred language has been added only to the user creation form. For existing users, you should access to the user profile, click over Preferences and go to the Preferred language page.
This commit is contained in:
@@ -327,6 +327,12 @@ function useredit_shared_definition(&$mform, $editoroptions, $filemanageroptions
|
||||
$mform->addElement('select', 'timezone', get_string('timezone'), $choices);
|
||||
}
|
||||
|
||||
if ($user->id < 0) {
|
||||
$mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
|
||||
$lang = empty($user->lang) ? $CFG->lang : $user->lang;
|
||||
$mform->setDefault('lang', $lang);
|
||||
}
|
||||
|
||||
if (!empty($CFG->allowuserthemes)) {
|
||||
$choices = array();
|
||||
$choices[''] = get_string('default');
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
@core @core_user
|
||||
Feature: Create manually an user.
|
||||
In order create a user properly
|
||||
As an admin
|
||||
I need to be able to add new users and edit their fields.
|
||||
|
||||
@javascript
|
||||
Scenario: Change default language for a new user
|
||||
Given I log in as "admin"
|
||||
When I navigate to "Add a new user" node in "Site administration > Users > Accounts"
|
||||
Then I should see "Preferred language"
|
||||
|
||||
@javascript
|
||||
Scenario: Language not displayed when editing an existing user
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
When I log in as "admin"
|
||||
And I navigate to "Browse list of users" node in "Site administration > Users > Accounts"
|
||||
And I follow "Student 1"
|
||||
And I follow "Edit profile"
|
||||
Then I should not see "Preferred language"
|
||||
Reference in New Issue
Block a user