Permalink
Browse files

MDL-28690 Do not automatically unenrol users from meta courses after …

…->longtimenosee days as this can lead to multiple 'welcome' messages
  • Loading branch information...
davosmith committed Aug 12, 2011
1 parent 1287d5e commit f802bf65a1ade3a3a18165307623ff994375dc54
Showing with 6 additions and 3 deletions.
  1. +6 −3 admin/cron.php
View
@@ -241,10 +241,13 @@
if ($CFG->longtimenosee) { // value in days
$cuttime = $timenow - ($CFG->longtimenosee * 3600 * 24);
- $rs = get_recordset_sql ("SELECT id, userid, courseid
- FROM {$CFG->prefix}user_lastaccess
+ $rs = get_recordset_sql ("SELECT la.id, la.userid, la.courseid
+ FROM {$CFG->prefix}user_lastaccess la
+ JOIN {$CFG->prefix}course c
+ ON c.id = la.courseid
WHERE courseid != ".SITEID."
- AND timeaccess < $cuttime ");
+ AND timeaccess < $cuttime
+ AND c.metacourse = 0 ");
while ($assign = rs_fetch_next_record($rs)) {
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
if (role_unassign(0, $assign->userid, 0, $context->id)) {

0 comments on commit f802bf6

Please sign in to comment.