-
Bug
-
Resolution: Fixed
-
Minor
-
1.9.10
-
MySQL
-
MOODLE_19_STABLE
-
MOODLE_19_STABLE
-
In Moodle 1.9.10+ (Build: 20110119), when running the admin cron job from command line or as a cron, the error "Invalid argument supplied for foreach() in /var/www/html/moodle/admin/cron.php" is entered in the log for this line:
foreach ($newusers as $newuserid => $newuser)
|
in this section of code:
//
|
// generate new password emails for users
|
//
|
mtrace('checking for create_password');
|
if (count_records('user_preferences', 'name', 'create_password', 'value', '1')) {
|
mtrace('creating passwords for new users');
|
$newusers = get_records_sql("SELECT u.id as id, u.email, u.firstname,
|
u.lastname, u.username,
|
p.id as prefid
|
FROM {$CFG->prefix}user u
|
JOIN {$CFG->prefix}user_preferences p ON u.id=p.userid
|
WHERE p.name='create_password' AND p.value='1' AND u.email !='' ");
|
|
foreach ($newusers as $newuserid => $newuser) { // ERROR ON THIS LINE
|
$newuser->emailstop = 0; // send email regardless
|
// email user
|
if (setnew_password_and_mail($newuser)) {
|
// remove user pref
|
delete_records('user_preferences', 'id', $newuser->prefid);
|
} else {
|
trigger_error("Could not create and mail new user password!");
|
}
|
}
|
}
|