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

XF 1.3 Custom User Fields import trouble vB to XF

#1
I ran an import from vB4 to XF and I'm having a little trouble with Custom User Fields

I have 12 custom user profile fields in vB that I wanted imported to XF.
Fields #5-12 imported as expected; Custom User Fields were created in XF and the data appears to be in OK in the 'xf_user_field_value' table.

The problem is with the 1st 4 custom fields from vB's 'profilefield' table.
No Custom User Fields were created in XF for these. No records in the 'xf_user_field' table for these.
For the data, the import did this:
inserted Field1 plus Field3 into the 'about' field in the xf_user_profile' table
inserted Field2 into the 'location' field in the xf_user_profile' table
inserted Field3 into the 'occupation' field in the xf_user_profile' table

I'm not sure, but I may have customized these 1st four vB fields vs. their use in a stock vB install.

Is there a way to change this mapping?
 

Mike

XenForo developer
Staff member
#2
There are 4 fields by default in vB that we import into their corresponding non-custom fields in XF. Unfortunately, there isn't a way to stop it without editing the code. (It has come up before, but only a couple of times I believe).

I think there would be 2 ways to tackle this:
  1. In the source DB, change the ID of these fields in the profilefield table (editing the ID) and in the userfield/usertextfield tables (changing field1 to field123 or whatever the new corresponding ID is). I believe this should work as we only read from those tables. I probably would only do this on a copy of the original database.
  2. Or change the importer to not skip the first 4 fields (remove WHERE profilefieldid > 4) and then remove the code that writes fields 1-4 into XF's core fields. (They should automatically be imported then like regular fields.)
 
#4
For method #2, where would I find this code to modify?
I've looked in \library\XenForo\Importer\vBulletin4x but do not see it there.
Thanks
 
#6
Right, I should have looked there.
I see the line "WHERE profilefieldid > 4" and can remove that.
I still could use some help with the "remove the code that writes fields 1-4 into XF's core fields" part of your instructions. (I'm not a coder.)
Where is that? Remove what lines?
 

Mike

XenForo developer
Staff member
#7
This code:
Code:
        $import['about'] = '';
        if (isset($user['field1']))
        {
            $import['about'] .= $this->_convertToUtf8($user['field1'], true) . "\n\n";
        }
        if (isset($user['field3']))
        {
            $import['about'] .= $this->_convertToUtf8($user['field3'], true) . "\n\n";
        }
        $import['about'] = trim($import['about']);

        if (isset($user['field2']))
        {
            $import['location'] = $this->_convertToUtf8($user['field2'], true);
        }
        if (isset($user['field4']))
        {
            $import['occupation'] = $this->_convertToUtf8($user['field4'], true);
        }