This now implements the new rule on who is a site student, see http://moodle.org/mod/forum/discuss.php?d=8452#56743

This commit is contained in:
gustav_delius
2004-08-30 16:42:32 +00:00
parent 4e65d23fd1
commit 30bc2fa671
3 changed files with 117 additions and 179 deletions
+8 -5
View File
@@ -584,21 +584,24 @@ 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;
}
$site = get_site();
if ($courseid == $site->id) {
if ($courseid == SITEID) {
if (!$userid) {
$userid = $USER->id;
}
if (isguest($userid)) {
return false;
}
return (record_exists('user_students', 'userid', $userid)
or (record_exists('user_teachers', '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) {