diff --git a/mod/chat/gui_header_js/insert.php b/mod/chat/gui_header_js/insert.php index 799d6842c78..6972bcc4a73 100644 --- a/mod/chat/gui_header_js/insert.php +++ b/mod/chat/gui_header_js/insert.php @@ -14,7 +14,7 @@ error('No chat found'); } - if (!$course = get_record('course', 'id', $chat->course, '', '', '','', 'id, shortname')) { + if (!$course = get_record('course', 'id', $chat->course)) { error('Could not find the course this belongs to!'); } diff --git a/mod/chat/lib.php b/mod/chat/lib.php index 7ca4f942b86..d69c9510dc2 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -199,12 +199,7 @@ function chat_print_recent_activity($course, $isteacher, $timestart) { if ($chat = get_record('chat', 'id', $chatuser->chatid)) { // we find the course module id - $chatmod = get_record('modules', 'name', 'chat'); - $SQL = "select * from {$CFG->prefix}course_modules where - course = $course->id - and module = $chatmod->id - and instance = $chat->id"; - $cm = get_records_sql($SQL); + $cm = get_coursemodule_from_instance('chat', $chat->id, $course->id); $context = get_context_instance(CONTEXT_MODULE, $cm->id); // needs to be fixed @@ -219,7 +214,7 @@ function chat_print_recent_activity($course, $isteacher, $timestart) { } $current = $chatuser->chatid; } - $fullname = fullname($chatuser, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_MODULE, $cm->id))); + $fullname = fullname($chatuser, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id))); echo '