]> git.mjollnir.org Git - moodle.git/commitdiff
People under switched roles should not be able to unenrol
authormoodler <moodler>
Thu, 21 Sep 2006 16:11:31 +0000 (16:11 +0000)
committermoodler <moodler>
Thu, 21 Sep 2006 16:11:31 +0000 (16:11 +0000)
course/unenrol.php
lang/en_utf8/error.php

index 742a04c54dff9ade6895923773d78c23fdbf3d8a..d33fa84f28f132d5c75b6478d35e56edceea61a2 100644 (file)
     require_login($course->id);
 
     if ($course->metacourse) {
-        print_error('cantunenrollfrommetacourse');
+        print_error('cantunenrollfrommetacourse', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
     } else {
         require_capability('moodle/role:unassignself', $context, NULL, false);
     }
 
+    if (!empty($USER->switchrole[$context->id])) {
+        print_error('cantunenrollinthisrole', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
+    }
+
     if ($confirm and confirm_sesskey()) {
 
         if (! role_unassign(0, $USER->id, 0, $context->id)) {
index 5e189eafd17a3cd3918d201d17fb02542a32c8ae..9277ea5a73a4373318ec7f3b8214fa348870c52d 100644 (file)
@@ -10,6 +10,8 @@ $string['cannotfindcomponent'] = 'Cannot find component.';
 $string['cannotsavezipfile'] = 'Cannot save ZIP file.';
 $string['cannotunzipfile'] = 'Cannot unzip file.';
 $string['cannotsavemd5file'] = 'Cannot save md5 file.';
+$string['cantunenrollinthisrole'] = 'You can not unenrol from this course while you are in your current role.';
+$string['cantunenrollfrommetacourse'] = 'You can not unenrol from this meta course.';
 $string['coursegroupunknown'] = 'Course corresponding to group $a not specified';
 $string['cmunknown'] = 'Couldn\'t find this course module';
 $string['componentisuptodate'] = 'Component is up to date.';