From: paca70 Date: Wed, 13 Oct 2004 07:16:24 +0000 (+0000) Subject: auth_iscreator return now three posible values: X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f894a7914ac2005c12f41a69ea8a096ad45dc67a;p=moodle.git auth_iscreator return now three posible values: null = not supported (Dont change user status) false = user not creator true = user is creator --- diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 9816c70606..4e47a226e0 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1423,20 +1423,23 @@ function authenticate_user_login($username, $password) { } if (function_exists('auth_iscreator')) { // Check if the user is a creator - if (auth_iscreator($username)) { - if (! record_exists('user_coursecreators', 'userid', $user->id)) { - $cdata->userid = $user->id; - if (! insert_record('user_coursecreators', $cdata)) { - error('Cannot add user to course creators.'); + $useriscreator = auth_iscreator($username); + if (!is_null($useriscreator)) { + if ($useriscreator) { + if (! record_exists('user_coursecreators', 'userid', $user->id)) { + $cdata->userid = $user->id; + if (! insert_record('user_coursecreators', $cdata)) { + error('Cannot add user to course creators.'); + } } - } - } else { - if (record_exists('user_coursecreators', 'userid', $user->id)) { - if (! delete_records('user_coursecreators', 'userid', $user->id)) { - error('Cannot remove user from course creators.'); + } else { + if (record_exists('user_coursecreators', 'userid', $user->id)) { + if (! delete_records('user_coursecreators', 'userid', $user->id)) { + error('Cannot remove user from course creators.'); + } } } - } + } } $user->sessionIP = md5(getremoteaddr()); // Store the current IP in the session return $user;