Fixed bug that caused empty string options to receive a '0' value on update. This was breaking fileupload_allowedusers, for example.

git-svn-id: https://develop.svn.wordpress.org/trunk@978 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dougal Campbell 2004-03-16 17:36:56 +00:00
parent 6ac36de172
commit fffefba32c
1 changed files with 6 additions and 1 deletions

View File

@ -74,7 +74,12 @@ $nonbools = array('default_ping_status', 'default_comment_status');
if ($user_level >= $option->option_admin_level) {
$old_val = stripslashes($option->option_value);
$new_val = $_POST[$option->option_name];
if (!$new_val) $new_val = 0;
if (!$new_val) {
if (3 == $option->option_type)
$new_val = '';
else
$new_val = 0;
}
if( in_array($option->option_name, $nonbools) && $new_val == 0 ) $new_value = 'closed';
if ($new_val !== $old_val) {
$query = "UPDATE $tableoptions SET option_value = '$new_val' WHERE option_id = $option->option_id";