<name>com.woltlab.wcf.user.signature</name>
<definitionname>com.woltlab.wcf.message</definitionname>
</type>
+ <type>
+ <name>com.woltlab.wcf.user.option.generic</name>
+ <definitionname>com.woltlab.wcf.message</definitionname>
+ </type>
<type>
<name>com.woltlab.wcf.bbcode.smiley</name>
public function save() {
parent::save();
+ $additionalData = array();
+ if ($this->optionType == 'select') $additionalData['allowEmptyValue'] = true;
+ if ($this->optionType == 'message') $additionalData['messageObjectType'] = 'com.woltlab.wcf.user.option.generic';
+
$this->objectAction = new UserOptionAction([], 'create', ['data' => array_merge($this->additionalFields, [
'optionName' => StringUtil::getRandomID(),
'categoryName' => $this->categoryName,
'editable' => $this->editable,
'visible' => $this->visible,
'packageID' => 1,
- 'additionalData' => $this->optionType == 'select' ? serialize(['allowEmptyValue' => true]) : ''
+ 'additionalData' => !empty($additionalData) ? serialize($additionalData) : ''
])]);
$this->objectAction->executeAction();
I18nHandler::getInstance()->save('optionName', 'wcf.user.option.'.$this->userOption->optionName, 'wcf.user.option');
I18nHandler::getInstance()->save('optionDescription', 'wcf.user.option.'.$this->userOption->optionName.'.description', 'wcf.user.option');
+ $additionalData = array();
+ if ($this->optionType == 'message') $additionalData['messageObjectType'] = 'com.woltlab.wcf.user.option.generic';
+
$this->objectAction = new UserOptionAction([$this->userOption], 'update', ['data' => array_merge($this->additionalFields, [
'categoryName' => $this->categoryName,
'optionType' => $this->optionType,
'askDuringRegistration' => $this->askDuringRegistration,
'searchable' => $this->searchable,
'editable' => $this->editable,
- 'visible' => $this->visible
+ 'visible' => $this->visible,
+ 'additionalData' => !empty($additionalData) ? serialize($additionalData) : ''
])]);
$this->objectAction->executeAction();
$this->saved();