Quick fix for an error showing up in some field types for the api

Added an error catch, re-indexing the languages array when a user is saved, to ensure that the indecies are numeric
This commit is contained in:
jacob 2010-12-02 18:43:35 +00:00
parent 77a3c77e69
commit 336cec80e0

View File

@ -521,6 +521,8 @@ function user_get_fields($userRoles = null){
$fields[$fieldName]['type'] = 'integer';
}else if(!strncmp($ftype, "tinytext", 8)){
$fields[$fieldName]['type'] = 'text';
}else if(!strncmp($ftype, "int", 3)){
$fields[$fieldName]['type'] = $fieldType[$fieldName];
}else{
$fields[$fieldName]['type'] = "ERROR:" . $fieldType[$fieldName];
}
@ -661,6 +663,11 @@ function user_save(&$u)
$set = "";
foreach($fields as $f) {
// re-indexing fields that might be mis-entered. Add additional field names to the array as needed.
if(in_array($f, array('languages'))){
$u[$f] = array_values($u[$f]);
}
if($u[$f] == $u['orig'][$f]) continue;
if($set != "") $set .=',';