mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merged from HEAD
This commit is contained in:
parent
e6e5113794
commit
2700d113a2
2 changed files with 84 additions and 124 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue