diff --git a/applications/dashboard/models/class.vbulletinimportmodel.php b/applications/dashboard/models/class.vbulletinimportmodel.php index 5291f737e9b..c1d9c774fe0 100755 --- a/applications/dashboard/models/class.vbulletinimportmodel.php +++ b/applications/dashboard/models/class.vbulletinimportmodel.php @@ -25,6 +25,8 @@ public function AfterImport() { $Router->SetRoute('member\.php\?u=(\d+)', 'dashboard/profile/$1/x', 'Permanent'); // Make different sizes of avatars $this->ProcessAvatars(); + // Prep config for ProfileExtender plugin based on imported fields + $this->ProfileExtenderPrep(); } /** @@ -68,4 +70,20 @@ public function ProcessAvatars() { } catch (Exception $ex) { } } } + + /** + * Get profile fields imported and add to ProfileFields list. + */ + public function ProfileExtenderPrep() { + $ProfileKeyData = $this->SQL->Select('m.Name')->Distinct()->From('UserMeta m')->Like('m.Name', 'Profile_%')->Get(); + $ExistingKeys = array_filter((array)explode(',', C('Plugins.ProfileExtender.ProfileFields', ''))); + foreach ($ProfileKeyData->Result() as $Key) { + $Name = str_replace('Profile_', '', $Key->Name); + if (!in_array($Name, $ExistingKeys)) { + $ExistingKeys[] = $Name; + } + } + if (count($ExistingKeys)) + SaveToConfig('Plugins.ProfileExtender.ProfileFields', implode(',', $ExistingKeys)); + } } \ No newline at end of file