require_login($course->id);
+if (isguest()) {
+ error("Guest does not have access to chat rooms");
+}
+
if (!$chat_sid = chat_login_user($chat->id, "header_js")) {
error("Could not log in to chat room!!");
}
require_login($course->id);
- if (!isteacher($course->id) and !$chat->studentlogs) {
- error("Only teachers are allowed to view these chat reports");
+ if (isguest() or (!isteacher($course->id) and !$chat->studentlogs)) {
+ error("You can not view these chat reports");
}
add_to_log($course->id, "chat", "view", "view.php?id=$cm->id", "$chat->id");
"", "", true, update_module_button($cm->id, $course->id, $strchat),
navmenu($course, $cm));
- if ($chat->studentlogs or isteacher($course->id)) {
+ if (($chat->studentlogs or isteacher($course->id)) and !isguest()) {
echo "<p align=right><a href=\"report.php?id=$chat->id\">".
get_string("viewreport", "chat")."</a></p>";
}
print_heading($chat->name);
- print_simple_box_start("center");
- link_to_popup_window ("/mod/chat/gui_$chatversion/index.php?id=$chat->id",
- "chat$course->id$chat->id", "$strenterchat", 500, 700, $strchat);
- print_simple_box_end();
+ if (!isguest()) {
+ print_simple_box_start("center");
+ link_to_popup_window ("/mod/chat/gui_$chatversion/index.php?id=$chat->id",
+ "chat$course->id$chat->id", "$strenterchat", 500, 700, $strchat);
+ print_simple_box_end();
+ }
if ($chat->chattime and $chat->schedule) { // A chat is scheduled