From 8e45587982f44b6490e813918b2111cb48abd158 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 4 Jun 2014 16:12:40 +0800 Subject: [PATCH] Do not try to enrol deleted users --- scripts/enrol.php | 5 +++-- scripts/test.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 scripts/test.php diff --git a/scripts/enrol.php b/scripts/enrol.php index 4c24912..6b60998 100644 --- a/scripts/enrol.php +++ b/scripts/enrol.php @@ -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 index 0000000..c71fb3e --- /dev/null +++ b/scripts/test.php @@ -0,0 +1,2 @@ +