This fixes bugs 2455, 2456 and maybe some others Eagle Eyes didn't have
the time to find. ;-)
* @todo Finish documenting this function
*/
function isteacherinanycourse($userid = 0, $includeadmin = true) {
+ global $USER;
+
if(empty($userid)) {
if(empty($USER) || empty($USER->id)) {
return false;
$userid = $USER->id;
}
+ if (isadmin($userid) && $includeadmin) { // admins can do anything
+ return true;
+ }
+
return record_exists('user_teachers', 'userid', $userid);
}