From daa8b1ac06ad38e0a07d2120a4779ba3afa6f0e7 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Tue, 3 Jan 2012 16:47:32 +0100 Subject: [PATCH] MDL-30948 do not generate new passwords for suspended accounts because they would not get any emails --- lib/cronlib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cronlib.php b/lib/cronlib.php index a2ab61e6019..83978d645ab 100644 --- a/lib/cronlib.php +++ b/lib/cronlib.php @@ -212,8 +212,9 @@ function cron_run() { p.id as prefid FROM {user} u JOIN {user_preferences} p ON u.id=p.userid - WHERE p.name='create_password' AND p.value='1' AND u.email !='' "); + WHERE p.name='create_password' AND p.value='1' AND u.email !='' AND u.suspended = 0 AND u.auth != 'nologin'"); + // note: we can not send emails to suspended accounts foreach ($newusers as $newuser) { if (setnew_password_and_mail($newuser)) { unset_user_preference('create_password', $newuser);