]> git.mjollnir.org Git - moodle.git/commitdiff
Merged MDL-6885 from stable
authormoodler <moodler>
Thu, 12 Oct 2006 07:28:22 +0000 (07:28 +0000)
committermoodler <moodler>
Thu, 12 Oct 2006 07:28:22 +0000 (07:28 +0000)
lib/moodlelib.php

index 8519da19ea4a973cc96aac69f5f90d5d8277611d..00072d7a8ebecaaaabbdcb241ac427c635815df6 100644 (file)
@@ -1630,8 +1630,15 @@ function require_login($courseid=0, $autologinguest=true, $cm=null) {
                     break;
 
                 default:    /// Guests not allowed
-                    print_header_simple();
-                    notice(get_string('guestsnotallowed', '', $course->fullname), "$CFG->wwwroot/login/index.php");
+                    print_header_simple('', '', get_string('loggedinasguest'));
+                    if (empty($USER->switchrole[$context->id])) {  // Normal guest
+                        notice(get_string('guestsnotallowed', '', $course->fullname), "$CFG->wwwroot/login/index.php");
+                    } else {
+                        notify(get_string('guestsnotallowed', '', $course->fullname));
+                        echo '<div class="notifyproblem">'.switchroles_form($course->id).'</div>';
+                        print_footer($course);
+                        exit;
+                    }
                     break;
             }