According to the final comments in SC#65:

Made isteacher() require that the first parameter (course id) be
specified and non-empty. If it is empty, [i.e., 0, which was used to
simulate what has now become isteacherinanycourse()], then the return
value IS correct but a warning is printed on screen. This should allow
us to track down any such calls in legacy modules without breaking Moodle.

The correct way to check for teacher status in ANY course is now to
call isteacherinanycourse().
This commit is contained in:
defacer 2005-01-23 21:38:01 +00:00
parent cae46b18c6
commit 9407d4563f
7 changed files with 33 additions and 12 deletions

View file

@ -28,7 +28,7 @@
if (!$CFG->showsiteparticipantslist and !isteacher(SITEID)) {
notice(get_string('sitepartlist0'));
}
if ($CFG->showsiteparticipantslist < 2 and !isteacher()) {
if ($CFG->showsiteparticipantslist < 2 and !isteacherinanycourse()) {
notice(get_string('sitepartlist1'));
}
}

View file

@ -69,7 +69,7 @@
}
if (!$course->category and !$currentuser) { // To reduce possibility of "browsing" userbase at site level
if (!isteacher() and !isteacher(0, $user->id) ) { // Teachers can browse and be browsed at site level
if (!isteacherinanycourse() and !isteacherinanycourse($user->id) ) { // Teachers can browse and be browsed at site level
print_header("$personalprofile: ", "$personalprofile: ",
"<a href=\"index.php?id=$course->id\">$participants</a>",
"", "", true, "&nbsp;", navmenu($course));