Skip to content

Commit

Permalink
create_new_user() can now import other fields from an external source
Browse files Browse the repository at this point in the history
if the function for it has been defined.  (Petri's code with additions by me)
  • Loading branch information
moodler committed Oct 5, 2002
1 parent 2a86e7a commit e858f9d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,15 @@ function save_session($VAR) {

function create_user_record($username, $password) {
// Creates a bare-bones user record
global $REMOTE_ADDR;
global $REMOTE_ADDR, $CFG;

if ($CFG->auth_update_userinfo and function_exists(auth_get_userinfo)) {
if ($newinfo = auth_get_userinfo($username)) {
foreach ($newinfo as $key=>$value){
$newuser->$key = $value;
}
}
}

$newuser->username = $username;
$newuser->password = md5($password);
Expand Down Expand Up @@ -1262,7 +1270,7 @@ function authenticate_user_login($username, $password) {
$CFG->auth = "email"; // Default authentication module
}

require("$CFG->dirroot/auth/$CFG->auth/lib.php");
require_once("$CFG->dirroot/auth/$CFG->auth/lib.php");

if (auth_user_login($username, $password)) { // Successful authentication

Expand Down

0 comments on commit e858f9d

Please sign in to comment.