Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

auth_iscreator return now three posible values:

null = not supported (Dont change user status)
false =  user not creator
true = user is creator
  • Loading branch information...
commit f894a7914ac2005c12f41a69ea8a096ad45dc67a 1 parent 911aba7
authored October 13, 2004

Showing 1 changed file with 14 additions and 11 deletions. Show diff stats Hide diff stats

  1. 25  lib/moodlelib.php
25  lib/moodlelib.php
@@ -1423,20 +1423,23 @@ function authenticate_user_login($username, $password) {
1423 1423
         }
1424 1424
 
1425 1425
         if (function_exists('auth_iscreator')) {    // Check if the user is a creator
1426  
-            if (auth_iscreator($username)) {
1427  
-                if (! record_exists('user_coursecreators', 'userid', $user->id)) {
1428  
-                    $cdata->userid = $user->id;
1429  
-                    if (! insert_record('user_coursecreators', $cdata)) {
1430  
-                        error('Cannot add user to course creators.');
  1426
+            $useriscreator = auth_iscreator($username);
  1427
+            if (!is_null($useriscreator)) {
  1428
+                if ($useriscreator) {
  1429
+                    if (! record_exists('user_coursecreators', 'userid', $user->id)) {
  1430
+                        $cdata->userid = $user->id;
  1431
+                        if (! insert_record('user_coursecreators', $cdata)) {
  1432
+                            error('Cannot add user to course creators.');
  1433
+                        }
1431 1434
                     }
1432  
-                }
1433  
-            } else {
1434  
-                if (record_exists('user_coursecreators', 'userid', $user->id)) {
1435  
-                    if (! delete_records('user_coursecreators', 'userid', $user->id)) {
1436  
-                        error('Cannot remove user from course creators.');
  1435
+                } else {
  1436
+                    if (record_exists('user_coursecreators', 'userid', $user->id)) {
  1437
+                        if (! delete_records('user_coursecreators', 'userid', $user->id)) {
  1438
+                            error('Cannot remove user from course creators.');
  1439
+                        }
1437 1440
                     }
1438 1441
                 }
1439  
-            }
  1442
+            }    
1440 1443
         }
1441 1444
         $user->sessionIP = md5(getremoteaddr());   // Store the current IP in the session
1442 1445
         return $user;

0 notes on commit f894a79

Please sign in to comment.
Something went wrong with that request. Please try again.