From fd2dcaa603aaf02f998b5573b72944680f1c8f8a Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 31 Dec 2013 13:45:14 +0800 Subject: [PATCH] MDL-43451 Cron: Retrieve additional name fields when creating passwords --- lib/cronlib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cronlib.php b/lib/cronlib.php index 49830c70f5d..37e09bae47e 100644 --- a/lib/cronlib.php +++ b/lib/cronlib.php @@ -223,8 +223,9 @@ function cron_run() { // Generate new password emails for users - ppl expect these generated asap if ($DB->count_records('user_preferences', array('name'=>'create_password', 'value'=>'1'))) { mtrace('Creating passwords for new users...'); - $newusers = $DB->get_recordset_sql("SELECT u.id as id, u.email, u.firstname, - u.lastname, u.username, u.lang, + $usernamefields = get_all_user_name_fields(true, 'u'); + $newusers = $DB->get_recordset_sql("SELECT u.id as id, u.email, + $usernamefields, u.username, u.lang, p.id as prefid FROM {user} u JOIN {user_preferences} p ON u.id=p.userid