• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Import from SMF wrong birthdays?

#1
I did a (test) import with SMF 2.0.13 data. Not sure if this is a bug or something else so I'll post it here.
Birthdays are not imported properly. Most of them are imported with year 1900 and a wrong month/day.

This is probably a date conversion thing. Anyone know about this?
 

Chris D

XenForo developer
Staff member
#2
What is the format of birth dates for the users in the SMF database which haven't been imported correctly?
 

Chris D

XenForo developer
Staff member
#4
Hmm, our code expects it to be "day-month-year", e.g. 22-05-1974

Do you know if this is something that has changed in recent years, or is configurable by the admin or can be stored differently based on localisation settings?
 

Chris D

XenForo developer
Staff member
#6
Then again, why did nobody complain about this before... weird.
This is definitely the important question. I don't recall that being mentioned before, which is bizarre as it has almost certainly been wrong for 2.5 years.

Hence why I assumed there must be some change or some setting (which would be especially odd considering its purpose).

Anyway, if you wanted to fix this for yourself and do the import again:

In library/XenForo/Importer/SMF.php change:
PHP:
if (trim($parts[2]) != '0001')
To:
PHP:
if (trim($parts[0]) != '0001')
Change:
PHP:
$import['dob_day'] = trim($parts[0]);
To:
PHP:
$import['dob_day'] = trim($parts[2]);
Change:
PHP:
$import['dob_year'] = trim($parts[2]);
To:
PHP:
$import['dob_year'] = trim($parts[0]);
And that should fix it.

If you're not planning to do another import, can you confirm what the dob_day, dob_month and dob_year fields have been imported as in XF? I'm hoping 1974, 5 and 22 respectively. If that's the case, we might be able to direct a SQL query to fix them, otherwise they'll be stuck like that or need resetting.
 

Bionic Rooster

Well-known member
#8
Then again, why did nobody complain about this before... weird.
This is definitely the important question. I don't recall that being mentioned before, which is bizarre as it has almost certainly been wrong for 2.5 years.
I can confirm that when I converted several years ago all dates were converted correctly. I don't remember what version of SMF I was converting from at the time but the converter worked correctly at that time.
 
#9
I get funky birthdates Xenforo after an SMF 2.0.13 import, too. Just like @Mr. Jinx , the smf_members.birthdate column is in a YYYY-MM-DD format. I have been making preparations to migrate from SMF since February and thought, given the silence about importing birthdays, that it must've just been a quirk with my instance of SMF. Up to now I've run queries to update the xf_user_profile dob year/month/day columns after import, but I'll give the Importer/SMF.php edits a shot as it will save some time - thanks @Chris D :).

SMF stores some birthdays with the year '0004', in cases where somebody has entered their birthday with the year omitted. Looking at Importer/SMF.php this doesn't appear to be taken into consideration. I'm guessing all this probably needs is the following condition added before $import['dob_year']:
PHP:
if (trim($parts[0]) != '0004')
 
#10
The fix from Chris D worked for me. I also had some birthdays with 0004 and changed those manually.
I also had some other problems with the importer, not related to birthdays. Maybe I'll write a small 'lessons learned' or something about my experiences.
 
#11
The fix from Chris D worked for me. I also had some birthdays with 0004 and changed those manually.
I also had some other problems with the importer, not related to birthdays. Maybe I'll write a small 'lessons learned' or something about my experiences.
Yeah I also have to run my own queries for user timezones as they don't import from SMF correctly either, with many defaulting to "Atlantic/Reykjavik" and not the SMF configured server time "Australia/Sydney" (although this is getting off topic sorry). :)