Skip to content

Commit

Permalink
MDL-28690 Do not automatically unenrol users from meta courses after …
Browse files Browse the repository at this point in the history
…->longtimenosee days as this can lead to multiple 'welcome' messages
  • Loading branch information
davosmith committed Aug 12, 2011
1 parent 1287d5e commit f802bf6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions admin/cron.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -241,10 +241,13 @@


if ($CFG->longtimenosee) { // value in days if ($CFG->longtimenosee) { // value in days
$cuttime = $timenow - ($CFG->longtimenosee * 3600 * 24); $cuttime = $timenow - ($CFG->longtimenosee * 3600 * 24);
$rs = get_recordset_sql ("SELECT id, userid, courseid $rs = get_recordset_sql ("SELECT la.id, la.userid, la.courseid
FROM {$CFG->prefix}user_lastaccess FROM {$CFG->prefix}user_lastaccess la
JOIN {$CFG->prefix}course c
ON c.id = la.courseid
WHERE courseid != ".SITEID." WHERE courseid != ".SITEID."
AND timeaccess < $cuttime "); AND timeaccess < $cuttime
AND c.metacourse = 0 ");
while ($assign = rs_fetch_next_record($rs)) { while ($assign = rs_fetch_next_record($rs)) {
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) { if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
if (role_unassign(0, $assign->userid, 0, $context->id)) { if (role_unassign(0, $assign->userid, 0, $context->id)) {
Expand Down

0 comments on commit f802bf6

Please sign in to comment.