From 5260006a086b7d00862cf25f37be10b041e763d7 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 15 Dec 2012 22:25:38 +0100 Subject: [PATCH] Fixed handling of user options without a default value --- .../files/lib/data/user/option/UserOptionEditor.class.php | 2 +- .../plugin/UserOptionPackageInstallationPlugin.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/data/user/option/UserOptionEditor.class.php b/wcfsetup/install/files/lib/data/user/option/UserOptionEditor.class.php index f38a366a5d..e9ee004415 100644 --- a/wcfsetup/install/files/lib/data/user/option/UserOptionEditor.class.php +++ b/wcfsetup/install/files/lib/data/user/option/UserOptionEditor.class.php @@ -29,7 +29,7 @@ class UserOptionEditor extends DatabaseObjectEditor { WCF::getDB()->getEditor()->addColumn('wcf'.WCF_N.'_user_option_value', 'userOption'.$userOption->optionID, self::getColumnDefinition($parameters['optionType'])); // add the default value to this column - if (isset($parameters['defaultValue'])) { + if (isset($parameters['defaultValue']) && $parameters['defaultValue'] !== null) { $sql = "UPDATE wcf".WCF_N."_user_option_value SET userOption".$userOption->optionID." = ?"; $statement = WCF::getDB()->prepareStatement($sql); diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php index 856c793df9..213ee90a2c 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php @@ -62,9 +62,9 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat */ protected function saveOption($option, $categoryName, $existingOptionID = 0) { // default values - $optionName = $optionType = $defaultValue = $validationPattern = $outputClass = $selectOptions = $enableOptions = $permissions = $options = ''; + $optionName = $optionType = $validationPattern = $outputClass = $selectOptions = $enableOptions = $permissions = $options = ''; $required = $editable = $visible = $searchable = $disabled = $askDuringRegistration = 0; - $showOrder = null; + $defaultValue = $showOrder = null; // get values if (isset($option['name'])) $optionName = $option['name']; -- 2.20.1