Skip to content

Commit

Permalink
auth_iscreator return now three posible values:
Browse files Browse the repository at this point in the history
null = not supported (Dont change user status)
false =  user not creator
true = user is creator
  • Loading branch information
paca70 committed Oct 13, 2004
1 parent 911aba7 commit f894a79
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions lib/moodlelib.php
Expand Up @@ -1423,20 +1423,23 @@ function authenticate_user_login($username, $password) {
} }


if (function_exists('auth_iscreator')) { // Check if the user is a creator if (function_exists('auth_iscreator')) { // Check if the user is a creator
if (auth_iscreator($username)) { $useriscreator = auth_iscreator($username);
if (! record_exists('user_coursecreators', 'userid', $user->id)) { if (!is_null($useriscreator)) {
$cdata->userid = $user->id; if ($useriscreator) {
if (! insert_record('user_coursecreators', $cdata)) { if (! record_exists('user_coursecreators', 'userid', $user->id)) {
error('Cannot add user to course creators.'); $cdata->userid = $user->id;
if (! insert_record('user_coursecreators', $cdata)) {
error('Cannot add user to course creators.');
}
} }
} } else {
} else { if (record_exists('user_coursecreators', 'userid', $user->id)) {
if (record_exists('user_coursecreators', 'userid', $user->id)) { if (! delete_records('user_coursecreators', 'userid', $user->id)) {
if (! delete_records('user_coursecreators', 'userid', $user->id)) { error('Cannot remove user from course creators.');
error('Cannot remove user from course creators.'); }
} }
} }
} }
} }
$user->sessionIP = md5(getremoteaddr()); // Store the current IP in the session $user->sessionIP = md5(getremoteaddr()); // Store the current IP in the session
return $user; return $user;
Expand Down

0 comments on commit f894a79

Please sign in to comment.