Skip to content

Commit

Permalink
vB import: Support ProfileExtender for seamless transition
Browse files Browse the repository at this point in the history
  • Loading branch information
linc committed Dec 5, 2011
1 parent 1f980f2 commit 1902637
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions applications/dashboard/models/class.vbulletinimportmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down Expand Up @@ -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.