From 19304cf75a12aa27a41d0c65ec9aedccbb57bab3 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 16 Feb 2011 16:49:53 +0000 Subject: [PATCH] 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. --- user.inc.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/user.inc.php b/user.inc.php index 1c885e6..070d0fc 100644 --- a/user.inc.php +++ b/user.inc.php @@ -196,10 +196,16 @@ function user_load($user, $uid = false) } $ret = mysql_fetch_assoc($q); + /* + echo "ret looks like: "; + echo "
";
+	print_r($ret);
+	echo "
"; + */ /* 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 "
User load returning: \n";
+/*
+	echo "
User load returning: \n";
 	print_r($ret);
 	echo "
"; -*/ + */ 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
";
+	//	print_r($u);
+	//	echo "
"; } else { /* The user has been specified and already exists, * just add a role */