Skip to content

Commit

Permalink
Merge branch 'MDL-41847-35' of git://github.com/sarjona/moodle into M…
Browse files Browse the repository at this point in the history
…OODLE_35_STABLE
  • Loading branch information
stronk7 committed Jul 31, 2018
2 parents 43eadce + 502b17b commit 6cf6523
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -6145,7 +6145,7 @@ function setnew_password_and_mail($user, $fasthash = false) {
$a->sitename = format_string($site->fullname);
$a->username = $user->username;
$a->newpassword = $newpassword;
$a->link = $CFG->wwwroot .'/login/';
$a->link = $CFG->wwwroot .'/login/?lang='.$lang;
$a->signoff = generate_email_signoff();

$message = (string)new lang_string('newusernewpasswordtext', '', $a, $lang);
Expand Down
6 changes: 6 additions & 0 deletions user/editlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
22 changes: 22 additions & 0 deletions user/tests/behat/addnewuser.feature
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 6cf6523

Please sign in to comment.