MDL-60518 core_user: A user with ID 0 is never a real user

This commit is contained in:
Frédéric Massart
2018-12-14 10:27:41 +01:00
committed by Amaia Anabitarte
parent c8b4ee45a4
commit 7dcc1e721c
3 changed files with 44 additions and 4 deletions
+3 -4
View File
@@ -517,18 +517,17 @@ class core_user {
}
/**
* Return true is user id is greater than self::NOREPLY_USER and
* alternatively check db.
* Return true if user id is greater than 0 and alternatively check db.
*
* @param int $userid user id.
* @param bool $checkdb if true userid will be checked in db. By default it's false, and
* userid is compared with NOREPLY_USER for performance.
* userid is compared with 0 for performance.
* @return bool true is real user else false.
*/
public static function is_real_user($userid, $checkdb = false) {
global $DB;
if ($userid < 0) {
if ($userid <= 0) {
return false;
}
if ($checkdb) {