From 09f88236d0bdf52ffcafb6916a9b50ccf7c4a61e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 19 Aug 2014 18:25:28 +0200 Subject: [PATCH] Assign an interface language in UserImporter see https://www.woltlab.com/forum/index.php/Thread/229091-Import-aus-VB4-2-Sprachauswahl-im-Profil-leer/ --- .../system/importer/UserImporter.class.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) 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, -- 2.20.1