I'm trying to get infomration for a block about course completions. I basically need to have all the information about a user, their courses and the state; have they started? have they completed?
It doesn't seem that:
$conditions = array('userid'=>$userid, 'course'=>$courseid);
$table = "course_completions";
$course = $DB->get_record($table, $conditions );
produces the correct results as it is showing one user on a course when they're not. It seems inconsistant so I've obviously missed something important. Can anyone guide me in the right direction please.
I've looks as some of the ad-hoc queries but none of them actually give me what I need.