Skip to content

Commit

Permalink
Merge branch '2.0.18' of github.com:vanillaforums/Garden into 2.0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
tburry committed Dec 6, 2011
2 parents af1e6b4 + 06c885d commit 2b129f9
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion applications/dashboard/models/class.vbulletinimportmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ 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();
}

/**
* Create different sizes of user photos.
*/
public function ProcessAvatars() {
$UploadImage = new Gdn_UploadImage();
$UserData = $this->SQL->Select('u.*')->From('User u')->Where('u.Photo is not null')->Get();
$UserData = $this->SQL->Select('u.Photo')->From('User u')->Where('u.Photo is not null')->Get();

// Make sure the avatars folder exists.
if (!file_exists(PATH_UPLOADS.'/userpics'))
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 2b129f9

Please sign in to comment.