MDL-30948 do not generate new passwords for suspended accounts because they would...
authorPetr Skoda <commits@skodak.org>
Tue, 3 Jan 2012 15:47:32 +0000 (16:47 +0100)
committerPetr Skoda <commits@skodak.org>
Tue, 3 Jan 2012 15:48:15 +0000 (16:48 +0100)
lib/cronlib.php

index a2ab61e..83978d6 100644 (file)
@@ -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);