newuserpasswordtext using many languages

Re: newuserpasswordtext using many languages

by Renaat Debleu -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

When a user creates a new account using self registration, the email with the password is sent in his/her own language.

This reminds me of an issue I raised with an additional plugin: registration with admin confirmation.  There the email to the admin user was sent in the language of the registrant.  Because you cannot expect that the admin understands every language, I asked the developer to update his code to send this email in the language of the admin user.

So one would expect that when an admin creates a new account using the French interface, the message is sent in French, when using German, the message is sent in German,...  But this is not happening, because the language is not (yet) set at that moment. 

Adding one line to the user/editadvanced.php file, should generate such an effect:

...
$usernew = $DB->get_record('user', array('id' => $usernew->id));
if ($createpassword) {
    ++$usernew->lang = $SESSION->lang;
    setnew_password_and_mail($usernew);
...