kkiely
02-11-2008, 11:18 PM
I'm doing a user import using Impex's text import module. I'm trying to get Impex to import one of the columns in my CSV file into one of the columns in the 'userfield' table.
I used these threads as a reference. The vbulletin.com team refers you to other Impex modules which use code for custom imports. The syntax used may be different though because the impex versions are older and the modules are different. Also, they supply code for creating a custom field and filling it, whereas, I am simply filing in a field I already have, so I don't think I need the code to create a new field.
http://www.vbulletin.com/forum/showthread.php?t=159437
http://www.vbulletin.com/forum/showthread.php?t=211656
So, I added the following line into my "txt_file/002.php" file - right before the line that says "// Check if user object is valid".
$try->add_custom_value($userfield[$user_id]['field8'], trim($bits["$order_in_file[pet1]"]));
My CSV file looks like this:
username,password,email@email.com,1,2,blah
I have added some custom fields into the "txt_file/000.php" file. The first few are standard fields in the user table so I can import additional info into that table. Then, the "pet1" field is a field in my userfield table.
var $_layout = array(
0 => 'NONE',
1 => 'username',
2 => 'id',
3 => 'email',
4 => 'password',
5 => 'lastactivity',
6 => 'lastvisit',
7 => 'ipaddress',
8 => 'pet1',
When I do a test import, I select the import fields as "username/password/email/lastactivity/lastvisit/pet1". All the "user" table info goes in fine (the first 5 fields). The fourth piece of data ("blah") goes into the 'userfield' table but always goes into the 'field5' column, which is the sixth column in the table (I thought that may matter). So, I can't get it to go where I want. I am also having trouble importing more than 1 field into the userfield table. I seem to be having trouble with the following portion of the code where I am trying to place the info into a particular column in my userfield table.
($userfield[$user_id]['field8']
I used these threads as a reference. The vbulletin.com team refers you to other Impex modules which use code for custom imports. The syntax used may be different though because the impex versions are older and the modules are different. Also, they supply code for creating a custom field and filling it, whereas, I am simply filing in a field I already have, so I don't think I need the code to create a new field.
http://www.vbulletin.com/forum/showthread.php?t=159437
http://www.vbulletin.com/forum/showthread.php?t=211656
So, I added the following line into my "txt_file/002.php" file - right before the line that says "// Check if user object is valid".
$try->add_custom_value($userfield[$user_id]['field8'], trim($bits["$order_in_file[pet1]"]));
My CSV file looks like this:
username,password,email@email.com,1,2,blah
I have added some custom fields into the "txt_file/000.php" file. The first few are standard fields in the user table so I can import additional info into that table. Then, the "pet1" field is a field in my userfield table.
var $_layout = array(
0 => 'NONE',
1 => 'username',
2 => 'id',
3 => 'email',
4 => 'password',
5 => 'lastactivity',
6 => 'lastvisit',
7 => 'ipaddress',
8 => 'pet1',
When I do a test import, I select the import fields as "username/password/email/lastactivity/lastvisit/pet1". All the "user" table info goes in fine (the first 5 fields). The fourth piece of data ("blah") goes into the 'userfield' table but always goes into the 'field5' column, which is the sixth column in the table (I thought that may matter). So, I can't get it to go where I want. I am also having trouble importing more than 1 field into the userfield table. I seem to be having trouble with the following portion of the code where I am trying to place the info into a particular column in my userfield table.
($userfield[$user_id]['field8']