Merged isteacher fix from stable

This commit is contained in:
moodler
2005-02-08 07:45:53 +00:00
parent 3dcdf943a2
commit fb830a1b60
+6 -3
View 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);
}