Do not try to enrol deleted users
authorFrederic Massart <fred@moodle.com>
Wed, 4 Jun 2014 08:12:40 +0000 (16:12 +0800)
committerFrederic Massart <fred@moodle.com>
Wed, 4 Jun 2014 08:12:40 +0000 (16:12 +0800)
scripts/enrol.php
scripts/test.php [new file with mode: 0644]

index 4c24912..6b60998 100644 (file)
@@ -49,9 +49,10 @@ function mdk_get_role($username) {
 
 $sql = "SELECT id, username
           FROM {user}
-         WHERE username LIKE 's%'
+         WHERE (username LIKE 's%'
             OR username LIKE 't%'
-            OR username LIKE 'm%'";
+            OR username LIKE 'm%')
+           AND deleted = 0";
 $users = $DB->get_recordset_sql($sql, array());
 $courses = $DB->get_records_select('course', 'id > ?', array(1), '', 'id, startdate');
 $plugin = new enrol_manual_plugin();
diff --git a/scripts/test.php b/scripts/test.php
new file mode 100644 (file)
index 0000000..c71fb3e
--- /dev/null
@@ -0,0 +1,2 @@
+<?php
+var_dump($argv);