Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
paca70 authored
Showing with 14 additions and 11 deletions.
  1. +14 −11 lib/moodlelib.php
View
25 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;
Please sign in to comment.
Something went wrong with that request. Please try again.