course)) { error('Could not find the course this belongs to!'); } if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) { error('Course Module ID was incorrect'); } $context = get_context_instance(CONTEXT_MODULE, $cm->id); //Get the user theme $USER = get_record('user', 'id', $chatuser->userid); //Setup course, lang and theme course_setup($chatuser->course); ob_start(); ?>