summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-25 19:50:48 +0000
committerGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-25 19:50:48 +0000
commitc529d247ffb5a0d1fe938ea0bba279bf6ba34a95 (patch)
tree3f9884a47ae7ab5103613138eb97f912d1db5df0 /modules
parent625b69e001e5f00b840924a0320c2880f5d3bf11 (diff)
downloadbrdo-c529d247ffb5a0d1fe938ea0bba279bf6ba34a95.tar.gz
brdo-c529d247ffb5a0d1fe938ea0bba279bf6ba34a95.tar.bz2
#53489, New User == Query failed: ERROR: invalid input syntax for integer: "", patch by Cvbge
Diffstat (limited to 'modules')
-rw-r--r--modules/user.module29
-rw-r--r--modules/user/user.module29
2 files changed, 38 insertions, 20 deletions
diff --git a/modules/user.module b/modules/user.module
index c04d0bcf1..7527b7794 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -161,17 +161,26 @@ function user_save($account, $array = array(), $category = 'account') {
// fields from being saved there. We cannot invoke hook_user('insert') here
// because we don't have a fully initialized user object yet.
foreach ($array as $key => $value) {
- if ($key == 'pass') {
- $fields[] = $key;
- $values[] = md5($value);
- $s[] = "'%s'";
- }
- else if (substr($key, 0, 4) !== 'auth') {
- if (in_array($key, $user_fields)) {
- $fields[] = db_escape_string($key);
- $values[] = $value;
+ switch($key) {
+ case 'pass':
+ $fields[] = $key;
+ $values[] = md5($value);
$s[] = "'%s'";
- }
+ break;
+ case 'uid': case 'mode': case 'sort':
+ case 'threshold': case 'created': case 'access':
+ case 'login': case 'status':
+ $fields[] = $key;
+ $values[] = $value;
+ $s[] = "%d";
+ break;
+ default:
+ if (substr($key, 0, 4) !== 'auth' && in_array($key, $user_fields)) {
+ $fields[] = $key;
+ $values[] = $value;
+ $s[] = "'%s'";
+ }
+ break;
}
}
db_query('INSERT INTO {users} ('. implode(', ', $fields) .') VALUES ('. implode(', ', $s) .')', $values);
diff --git a/modules/user/user.module b/modules/user/user.module
index c04d0bcf1..7527b7794 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -161,17 +161,26 @@ function user_save($account, $array = array(), $category = 'account') {
// fields from being saved there. We cannot invoke hook_user('insert') here
// because we don't have a fully initialized user object yet.
foreach ($array as $key => $value) {
- if ($key == 'pass') {
- $fields[] = $key;
- $values[] = md5($value);
- $s[] = "'%s'";
- }
- else if (substr($key, 0, 4) !== 'auth') {
- if (in_array($key, $user_fields)) {
- $fields[] = db_escape_string($key);
- $values[] = $value;
+ switch($key) {
+ case 'pass':
+ $fields[] = $key;
+ $values[] = md5($value);
$s[] = "'%s'";
- }
+ break;
+ case 'uid': case 'mode': case 'sort':
+ case 'threshold': case 'created': case 'access':
+ case 'login': case 'status':
+ $fields[] = $key;
+ $values[] = $value;
+ $s[] = "%d";
+ break;
+ default:
+ if (substr($key, 0, 4) !== 'auth' && in_array($key, $user_fields)) {
+ $fields[] = $key;
+ $values[] = $value;
+ $s[] = "'%s'";
+ }
+ break;
}
}
db_query('INSERT INTO {users} ('. implode(', ', $fields) .') VALUES ('. implode(', ', $s) .')', $values);