Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

More restrictions on enrol/unenrol of meta courses. Thanks to Bug #4057

  • Loading branch information...
commit 498ef90f7b9be57bf261d148a70b72658c9e8dc9 1 parent ace9977
authored November 15, 2005
2  blocks/admin/block_admin.php
@@ -189,7 +189,7 @@ function load_content_for_course() {
189 189
                 $this->content->items[]='<a href="'.$CFG->changepassword.'">'.get_string('changepassword').'</a>';
190 190
                 $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
191 191
             }
192  
-            if ($CFG->allowunenroll) {
  192
+            if ($CFG->allowunenroll && !$course->metacourse) {
193 193
                 $this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'</a>';
194 194
                 $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
195 195
             }
4  course/importstudents.php
@@ -27,8 +27,8 @@
27 27
         redirect("$CFG->wwwroot/course/student.php?id=$course->id");
28 28
     }
29 29
 
30  
-    if (!isadmin()) {
31  
-        error("You must be an admin");
  30
+    if (!isadmin() || !isteacheredit($course->id)) {
  31
+        error("You must be an admin or a teacher of this course");
32 32
     }
33 33
 
34 34
 
2  course/unenrol.php
@@ -24,7 +24,7 @@
24 24
         error("You must be a teacher with editing rights to do this");
25 25
     }
26 26
 
27  
-    if ($user->id == $USER->id and !$CFG->allowunenroll) {
  27
+    if ($user->id == $USER->id and !$CFG->allowunenroll or $course->metacourse) {
28 28
         error("You are not allowed to unenroll");
29 29
     }
30 30
 

0 notes on commit 498ef90

Please sign in to comment.
Something went wrong with that request. Please try again.