Change query @row 826
SELECT ue.userid, ue.status, ue.timestart, ue.timeend FROM {user_enrolments} ue JOIN {enrol} e ON e.id = ue.enrolid WHERE ue.userid $usql AND e.status = :estatus AND e.courseid = :courseid GROUP BY ue.userid, ue.status, ue.timestart,ue.timeend
and @row 851
SELECT ue.userid, ue.status, ue.timestart, ue.timeend FROM {user_enrolments} ue JOIN {enrol} e ON e.id = ue.enrolid WHERE ue.userid = :uid AND e.status = :estatus AND e.courseid = :courseid GROUP BY ue.userid,ue.status, ue.timestart, ue.timeend
have fun