SMF Support > Converting to SMF

Tweaking the converter for Membermap (Gold) data?

(1/2) > >>

This seems relatively simple, though I can't possibly manage this on my own, and would possibly be useful to others converting from Gold, who have the Member Map mod installed.

It would be a much tidier conversion for me if the data that is in the Location field could be tweaked, it is currently inserting this into the member location:

--- Code: ---x1|Rugby, Warwickshire|United_Kingdom|united_kingdom|308|296|
--- End code ---

Could someone please help so that the code of one of the conversion scripts only inserts the second section of this location data instead?

No takers?  :P

Okay, this looks like it might work, given that the location data is in $userData[15]? This is a stab in the dark, so please don't laugh.

--- Code: --- beginStep(5);

// Getting members information
echo '
Importing Member Data:

$dh = opendir($_REQUEST['membersdir']);
$insertData = array();
while ($file = readdir($dh))
$extension = substr(strrchr($file, '.'), 1);
if ($extension != 'dat')

if (isset($user))
echo ', ';

$user = substr($file, 0, strrpos($file, '.'));

$userData = file($_REQUEST['membersdir'] . '/' . $file);
for ($i = 0; $i < sizeof($userData); $i++)
$userData[$i] = mysql_escape_string(trim(htmlspecialchars($userData[$i])));

$userData = array_pad($userData, 20, '');

// Just use md5, it'll get upgraded.
$password = md5(stripcslashes($userData[0]));

$userData[14] = get_yabb_time(stripcslashes($userData[14]));

$birthdate = $userData[16] == '' ? 0 : strtotime(stripcslashes($userData[16]));

if ($birthdate <= 0 && $userData[16] != '')
if (preg_match("/(\d\d)\/(\d\d)\/(\d\d)(.*)(\d\d)\:(\d\d)\:(\d\d)/i", stripcslashes($userData[16]), $matches))
$birthdate = strtotime("$matches[5]:$matches[6]:$matches[7] $matches[1]/$matches[2]/$matches[3]");

if ($birthdate > 0)
$tmp = getdate($birthdate);
$userData[16] = "$tmp[year]-$tmp[mon]-$tmp[mday]";
$userData[16] = '0000-00-00';

$userData[19] = $userData[19] == 'checked' ? '1' : '0';

$userData[5] = str_replace(array('&&', '&amp;&amp;'), "\n", $userData[5]);
//*  Yabb Gold Membermap tweak
$pos = strpos("|", $userData[15]);
if ($pos !== FALSE){
$userLocation = explode("|",$userData[15]);
$userData[15] = $userLocation[2];
//*  Yabb Gold Membermap tweak end
if ($userData[4] == 'Guest')
$userData[4] = $userData[1];

$insertData[$user] = "('$user', '$password', '$userData[1]', '$userData[2]', '$userData[3]', '$userData[4]', '$userData[5]', '$userData[6]', '$userData[7]', '$userData[8]', '$userData[9]', '$userData[10]', '$userData[11]', '$userData[12]', '$userData[13]', '$userData[14]', '$userData[15]', '$userData[16]', '$userData[18]', '$userData[19]')";

echo $user;

echo '

// Inserting Members

--- End code ---

I know just enough about YaBB to tweak the converter... sorry, I can't really tell you if that's right or not.


Okay, thanks. Maybe instead, run a script that would change all the piped locations in the tables to the correct data, that would be fairly simple too wouldn't it? Not simple for me, I don't know a lick of mysql scripting yet.

If I wanted to do a test SEinstall/convert on my main forum to make sure it works, is there any reason why I would have to put the Gold board into maintainance mode to do that if it's not busy? I won't be keeping it after all, just testing the conversion one more time.

Well, it'd be best to in case someone started a topic in the middle of conversion...



[0] Message Index

[#] Next page

Go to full version