forked from science-ation/science-ation
- Fix the new user function, the user table is now UNIQUE in (username,year),
so we need to insert both.
This commit is contained in:
parent
eecb099e9b
commit
6a1de0f2f3
@ -150,6 +150,8 @@ function user_load($user, $uid = false)
|
|||||||
|
|
||||||
if(mysql_num_rows($q)!=1) {
|
if(mysql_num_rows($q)!=1) {
|
||||||
echo "Query [$query] returned ".mysql_num_rows($q)." rows\n";
|
echo "Query [$query] returned ".mysql_num_rows($q)." rows\n";
|
||||||
|
// echo "<pre>";
|
||||||
|
// print_r(debug_backtrace());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,12 +567,13 @@ function user_add_role_allowed($type, $u)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function user_create($type, $u = NULL)
|
function user_create($type, $username, $u = NULL)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
if(!is_array($u)) {
|
if(!is_array($u)) {
|
||||||
mysql_query("INSERT INTO users (`types`,`passwordset`,`created`,`year`)
|
mysql_query("INSERT INTO users (`types`,`username`,`passwordset`,`created`,`year`)
|
||||||
VALUES ('$type', '0000-00-00', NOW(), '{$config['FAIRYEAR']}')");
|
VALUES ('$type', '$username','0000-00-00', NOW(), '{$config['FAIRYEAR']}')");
|
||||||
|
echo mysql_error();
|
||||||
$uid = mysql_insert_id();
|
$uid = mysql_insert_id();
|
||||||
mysql_query("UPDATE users SET uid='$uid' WHERE id='$uid'");
|
mysql_query("UPDATE users SET uid='$uid' WHERE id='$uid'");
|
||||||
user_set_password($uid, NULL);
|
user_set_password($uid, NULL);
|
||||||
|
@ -171,10 +171,9 @@
|
|||||||
|
|
||||||
/* Add the user, user_create sets a random/expired password,
|
/* Add the user, user_create sets a random/expired password,
|
||||||
* so we'll just use that */
|
* so we'll just use that */
|
||||||
$u = user_create($type);
|
$u = user_create($type, $data_email);
|
||||||
$u['firstname'] = $data_fn;
|
$u['firstname'] = $data_fn;
|
||||||
$u['lastname'] = $data_ln;
|
$u['lastname'] = $data_ln;
|
||||||
$u['username'] = $data_email;
|
|
||||||
$u['email'] = $data_email;
|
$u['email'] = $data_email;
|
||||||
user_save($u);
|
user_save($u);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user