diff --git a/user.inc.php b/user.inc.php index 931d8cc..faa77dd 100644 --- a/user.inc.php +++ b/user.inc.php @@ -150,6 +150,8 @@ function user_load($user, $uid = false) if(mysql_num_rows($q)!=1) { echo "Query [$query] returned ".mysql_num_rows($q)." rows\n"; +// echo "
"; +// print_r(debug_backtrace()); return false; } @@ -565,12 +567,13 @@ function user_add_role_allowed($type, $u) return false; } -function user_create($type, $u = NULL) +function user_create($type, $username, $u = NULL) { global $config; if(!is_array($u)) { - mysql_query("INSERT INTO users (`types`,`passwordset`,`created`,`year`) - VALUES ('$type', '0000-00-00', NOW(), '{$config['FAIRYEAR']}')"); + mysql_query("INSERT INTO users (`types`,`username`,`passwordset`,`created`,`year`) + VALUES ('$type', '$username','0000-00-00', NOW(), '{$config['FAIRYEAR']}')"); + echo mysql_error(); $uid = mysql_insert_id(); mysql_query("UPDATE users SET uid='$uid' WHERE id='$uid'"); user_set_password($uid, NULL); diff --git a/user_new.php b/user_new.php index ac9c2db..61300c2 100644 --- a/user_new.php +++ b/user_new.php @@ -171,10 +171,9 @@ /* Add the user, user_create sets a random/expired password, * so we'll just use that */ - $u = user_create($type); + $u = user_create($type, $data_email); $u['firstname'] = $data_fn; $u['lastname'] = $data_ln; - $u['username'] = $data_email; $u['email'] = $data_email; user_save($u);