]> git.mjollnir.org Git - moodle.git/commitdiff
auth_iscreator return now three posible values:
authorpaca70 <paca70>
Wed, 13 Oct 2004 07:16:24 +0000 (07:16 +0000)
committerpaca70 <paca70>
Wed, 13 Oct 2004 07:16:24 +0000 (07:16 +0000)
null = not supported (Dont change user status)
false =  user not creator
true = user is creator

lib/moodlelib.php

index 9816c70606b37dc7be8c6fb33e8f2ac01d9d63c1..4e47a226e0e34359be7c53503336bdaaafff28aa 100644 (file)
@@ -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;