Merged isteacher fix from stable
authormoodler <moodler>
Tue, 8 Feb 2005 07:45:53 +0000 (07:45 +0000)
committermoodler <moodler>
Tue, 8 Feb 2005 07:45:53 +0000 (07:45 +0000)
lib/moodlelib.php

index 5520e236157660ccb96deaf1d151a6db395d0f6d..56ba4ef3f9c90aa074d9d483597b623dd2302543 100644 (file)
@@ -1379,15 +1379,18 @@ function isadmin($userid=0) {
  * @return boolean
  * @todo Finish documenting this function
  */
-function isteacher($courseid, $userid=0, $includeadmin=true) {
-    global $USER;
+function isteacher($courseid=0, $userid=0, $includeadmin=true) {
+/// Is the user a teacher or admin?
+    global $USER, $CFG;
 
     if ($includeadmin and isadmin($userid)) {  // admins can do anything the teacher can
         return true;
     }
 
     if (empty($courseid)) {
-        notify('isteacher() should not be used without a valid course id as argument');
+        if (isadmin() or $CFG->debug > 7) {
+            notify('Coding error: isteacher() should not be used without a valid course id as argument.  Please notify a developer.');
+        }
         return isteacherinanycourse($userid, $includeadmin);
     }