View Single Post
  #1  
Old 02-11-2008, 11:18 PM
kkiely kkiely is offline
 
Join Date: Feb 2004
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Impex User Import - import data into userfield table

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".

Code:
$try->add_custom_value($userfield[$user_id]['field8'], trim($bits["$order_in_file[pet1]"]));
My CSV file looks like this:

Code:
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.

Code:
	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.

Code:
($userfield[$user_id]['field8']
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01058 seconds
  • Memory Usage 1,768KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete