Permalink
Browse files

vB import: Support ProfileExtender for seamless transition

  • Loading branch information...
1 parent 1f980f2 commit 19026375f9cb136a04ff8665347665d0523422a8 @linc linc committed Nov 11, 2011
Showing with 18 additions and 0 deletions.
  1. +18 −0 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));
+ }
}

0 comments on commit 1902637

Please sign in to comment.