From: Tim Düsterhus Date: Tue, 19 Aug 2014 16:25:28 +0000 (+0200) Subject: Assign an interface language in UserImporter X-Git-Tag: 2.1.0_Alpha_1~428 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=09f88236d0bdf52ffcafb6916a9b50ccf7c4a61e;p=GitHub%2FWoltLab%2FWCF.git Assign an interface language in UserImporter see https://www.woltlab.com/forum/index.php/Thread/229091-Import-aus-VB4-2-Sprachauswahl-im-Profil-leer/ --- diff --git a/wcfsetup/install/files/lib/system/importer/UserImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserImporter.class.php index 664b1828ce..5beab5d764 100644 --- a/wcfsetup/install/files/lib/system/importer/UserImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserImporter.class.php @@ -134,6 +134,20 @@ class UserImporter extends AbstractImporter { } } + $languageIDs = array(); + if (isset($additionalData['languages'])) { + foreach ($additionalData['languages'] as $languageCode) { + $language = LanguageFactory::getInstance()->getLanguageByCode($languageCode); + if ($language !== null) $languageIDs[] = $language->languageID; + } + } + if (empty($languageIDs)) { + $languageIDs[] = LanguageFactory::getInstance()->getDefaultLanguageID(); + } + + // assign an interface language + $data['languageID'] = reset($languageIDs); + // create user $user = UserEditor::create($data); $userEditor = new UserEditor($user); @@ -170,16 +184,6 @@ class UserImporter extends AbstractImporter { (userID, languageID) VALUES (?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $languageIDs = array(); - if (isset($additionalData['languages'])) { - foreach ($additionalData['languages'] as $languageCode) { - $language = LanguageFactory::getInstance()->getLanguageByCode($languageCode); - if ($language !== null) $languageIDs[] = $language->languageID; - } - } - if (empty($languageIDs)) { - $languageIDs[] = LanguageFactory::getInstance()->getDefaultLanguageID(); - } foreach ($languageIDs as $languageID) { $statement->execute(array( $user->userID,