Merged from HEAD

This commit is contained in:
gustav_delius 2004-08-30 17:27:00 +00:00
parent e6e5113794
commit 2700d113a2
2 changed files with 84 additions and 124 deletions

View file

@ -579,7 +579,7 @@ function isstudent($courseid, $userid=0) {
/// If course is site, is the user a confirmed user on the site?
global $USER;
if (empty($USER->id)) {
if (empty($USER->id) and !$userid) {
return false;
}
@ -590,7 +590,13 @@ function isstudent($courseid, $userid=0) {
if (isguest($userid)) {
return false;
}
return record_exists('user_students', 'userid', $userid);
if ($CFG->allusersaresitestudents) {
return record_exists('user', 'id', $userid);
} else {
return (record_exists('user_students', 'userid', $userid)
or (record_exists('user_teachers', 'userid', $userid)
and !record_exists('user_teachers', 'userid', $userid, 'course', SITEID)));
}
}
if (!$userid) {