forked from science-ation/science-ation
When adding a user with user_create, we need to set deleted='no', also, update user_load to catch an empty 'deleted' field, instead of only looking for !='no' becuase now we have users in the system without any deleted field. fuck.
This commit is contained in:
parent
727bae005b
commit
19304cf75a
20
user.inc.php
20
user.inc.php
@ -196,10 +196,16 @@ function user_load($user, $uid = false)
|
||||
}
|
||||
|
||||
$ret = mysql_fetch_assoc($q);
|
||||
/*
|
||||
echo "ret looks like: ";
|
||||
echo "<pre>";
|
||||
print_r($ret);
|
||||
echo "</pre>";
|
||||
*/
|
||||
|
||||
/* Make sure they're not deleted, we don't want to do this in the query, because loading by $uid would
|
||||
* simply return the previous year (where deleted=no) */
|
||||
if($ret['deleted'] != 'no') {
|
||||
if($ret['deleted'] == 'yes' ) {
|
||||
/* User is deleted */
|
||||
return false;
|
||||
}
|
||||
@ -261,10 +267,11 @@ function user_load($user, $uid = false)
|
||||
$orig = $ret;
|
||||
$ret['orig'] = $orig;
|
||||
|
||||
/* echo "<pre>User load returning: \n";
|
||||
/*
|
||||
echo "<pre>User load returning: \n";
|
||||
print_r($ret);
|
||||
echo "</pre>";
|
||||
*/
|
||||
*/
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -726,8 +733,8 @@ function user_create($type, $username, $u = NULL)
|
||||
{
|
||||
global $config;
|
||||
if(!is_array($u)) {
|
||||
mysql_query("INSERT INTO users (`types`,`username`,`passwordset`,`created`,`year`)
|
||||
VALUES ('$type','$username','0000-00-00', NOW(), '{$config['FAIRYEAR']}')");
|
||||
mysql_query("INSERT INTO users (`types`,`username`,`passwordset`,`created`,`year`,`deleted`)
|
||||
VALUES ('$type','$username','0000-00-00', NOW(), '{$config['FAIRYEAR']}','no')");
|
||||
echo mysql_error();
|
||||
$uid = mysql_insert_id();
|
||||
if(user_valid_email($username)) {
|
||||
@ -742,6 +749,9 @@ function user_create($type, $username, $u = NULL)
|
||||
echo mysql_error();
|
||||
/* Load the complete user */
|
||||
$u = user_load($uid);
|
||||
// echo "user_create / user_load($uid) returned <pre>";
|
||||
// print_r($u);
|
||||
// echo "</pre>";
|
||||
} else {
|
||||
/* The user has been specified and already exists,
|
||||
* just add a role */
|
||||
|
Loading…
Reference in New Issue
Block a user