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);
|
$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
|
/* 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) */
|
* simply return the previous year (where deleted=no) */
|
||||||
if($ret['deleted'] != 'no') {
|
if($ret['deleted'] == 'yes' ) {
|
||||||
/* User is deleted */
|
/* User is deleted */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -261,10 +267,11 @@ function user_load($user, $uid = false)
|
|||||||
$orig = $ret;
|
$orig = $ret;
|
||||||
$ret['orig'] = $orig;
|
$ret['orig'] = $orig;
|
||||||
|
|
||||||
/* echo "<pre>User load returning: \n";
|
/*
|
||||||
|
echo "<pre>User load returning: \n";
|
||||||
print_r($ret);
|
print_r($ret);
|
||||||
echo "</pre>";
|
echo "</pre>";
|
||||||
*/
|
*/
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -726,8 +733,8 @@ 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`,`username`,`passwordset`,`created`,`year`)
|
mysql_query("INSERT INTO users (`types`,`username`,`passwordset`,`created`,`year`,`deleted`)
|
||||||
VALUES ('$type','$username','0000-00-00', NOW(), '{$config['FAIRYEAR']}')");
|
VALUES ('$type','$username','0000-00-00', NOW(), '{$config['FAIRYEAR']}','no')");
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
$uid = mysql_insert_id();
|
$uid = mysql_insert_id();
|
||||||
if(user_valid_email($username)) {
|
if(user_valid_email($username)) {
|
||||||
@ -742,6 +749,9 @@ function user_create($type, $username, $u = NULL)
|
|||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
/* Load the complete user */
|
/* Load the complete user */
|
||||||
$u = user_load($uid);
|
$u = user_load($uid);
|
||||||
|
// echo "user_create / user_load($uid) returned <pre>";
|
||||||
|
// print_r($u);
|
||||||
|
// echo "</pre>";
|
||||||
} else {
|
} else {
|
||||||
/* The user has been specified and already exists,
|
/* The user has been specified and already exists,
|
||||||
* just add a role */
|
* just add a role */
|
||||||
|
Loading…
Reference in New Issue
Block a user