/** * Creates a new UserImporter object. */ public function __construct() { // get default notification events $sql = "SELECT\teventID\n\t\t\tFROM\twcf" . WCF_N . "_user_notification_event\n\t\t\tWHERE\tpreset = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array(1)); while ($row = $statement->fetchArray()) { $this->eventIDs[] = $row['eventID']; } $userOptionList = new UserOptionList(); $userOptionList->readObjects(); $this->userOptions = $userOptionList->getObjects(); }
public function getCustomRegisterFields() { $custom_register_fields = array(); $userOptionList = new UserOptionList(); $userOptionList->readObjects(); $userOptions = $userOptionList->getObjects(); foreach ($userOptions as $userOptionId => $userOption) { if (!$userOption->askDuringRegistration) { continue; } $optionName = WCF::getLanguage()->getDynamicVariable('wcf.user.option.' . $userOption->optionName); $optionDescription = WCF::getLanguage()->getDynamicVariable('wcf.user.option.' . $userOption->optionName . '.description'); $field_type = ""; $format = ""; $options = ""; $selectOptions = ""; switch ($userOption->optionType) { case 'integer': case 'float': case 'password': case 'URL': case 'text': $field_type = 'input'; break; case 'birthday': case 'date': $field_type = 'input'; $format = 'nnnn-nn-nn'; break; case 'aboutMe': case 'textarea': case 'message': $field_type = 'textarea'; break; case 'select': $field_type = 'drop'; $selectOptions = $userOption->parseSelectOptions(); break; case 'boolean': case 'radioButton': $field_type = 'radio'; $selectOptions = $userOption->parseSelectOptions(); break; case 'multiSelect': case 'checkboxes': $field_type = 'cbox'; $selectOptions = $userOption->parseSelectOptions(); break; } if (isset($selectOptions) && !empty($selectOptions)) { foreach ($selectOptions as $key => $optionValue) { $options .= $key . '=' . trim($optionValue) . '|'; } $options = rtrim($options, '|'); } $custom_register_fields[] = array('name' => $optionName, 'description' => $optionDescription, 'key' => $userOption->optionName, 'type' => $field_type, 'options' => $options, 'format' => $format); } return $custom_register_fields; }