mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-72634 user: populate default city/country during user creation.
This commit is contained in:
parent
34ce1463cc
commit
b6d8939959
3 changed files with 37 additions and 4 deletions
|
@ -94,6 +94,13 @@ function user_create_user($user, $updatepassword = true, $triggerevent = true) {
|
|||
if (!isset($user->lang)) {
|
||||
$user->lang = core_user::get_property_default('lang');
|
||||
}
|
||||
if (!isset($user->city)) {
|
||||
$user->city = core_user::get_property_default('city');
|
||||
}
|
||||
if (!isset($user->country)) {
|
||||
// The default value of $CFG->country is 0, but that isn't a valid property for the user field, so switch to ''.
|
||||
$user->country = core_user::get_property_default('country') ?: '';
|
||||
}
|
||||
|
||||
$user->timecreated = time();
|
||||
$user->timemodified = $user->timecreated;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue