Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-05-2010, 02:44 PM
bigrover bigrover is offline
 
Join Date: Jun 2010
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Impex mod for custom field import from IBP2

I am trying to import an additional data column from my IPB 2.3.6 source. I found a number of posts on modifications to the 004.php fle in the Impex system, but none of the suggestions work for me.

First I tried the following:
$this->add_custom_field($Db_target, $tdt, $ttp, 'loginname','name');
$try->add_custom_value('loginname', $user_details['name']);

This didn't create the loginname column, and obviously didn't populate it. I then manually created the loginname column as varchar 255. I commented out the add_custom_field command and ran the import but no data filled the loginname column. I then tried the following:

$try->add_default_value('loginname', $user_details['name']);

This also resulted in no data inserted in the column. I know there is valid data in the 'name' field as it is the standard value to be imported to the username column and it is working. I'm able to change the source field going into the username column at will as well, having assigned it to members_display_name. I just cannot get the new column to populate using Impex. With no modifications to the 004.php file the import takes 30 seconds, but any changes this goes up to 120 seconds. Impex is trying to do something, but I don't know what.

On this site, the only file I have edited is impex/systems/ipb2/004.php.

Any suggestions?
Reply With Quote
  #2  
Old 08-05-2010, 05:03 PM
bigrover bigrover is offline
 
Join Date: Jun 2010
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am trying to add data to a new field/column named 'loginname' in the user table.

I made some progress by dropping previous examples and hacking at it myself. In the ipb2/004.php file I made the following changes in the data assignment section at line 129:

// hack
// $try->set_value('mandatory', 'username', $user_details['name']);
$try->set_value('mandatory', 'username', $user_details['members_display_name']);
$try->set_value('mandatory', 'loginname', $user_details['name']);
// end hack

I also hacked the results display section at line 266 to display the new datafield 'loginname':

// hack
// $displayobject->display_now('<br /><span class="isucc"><b>' . $try->how_complete() . '%</b></span> ' . $displayobject->phrases['user'] . ' -> ' . $try->get_value('mandatory','username'));
$displayobject->display_now('<br /><span class="isucc"><b>' . $try->how_complete() . '%</b></span> ' . $displayobject->phrases['user'] . ' -> ' . $try->get_value('mandatory','username') . ' -> ' . $try->get_value('mandatory','loginname'));
// end hack

Lastly, I added a record to the vbfields table for the 'loginname' field in the users table. When I REDO the user import now, the correct information is displaying on the screen, meaning both the username and loginname fields are displayed with the correct data. But I am still not getting the loginname into the users table. The set_value function working at least to the point of having the data where the get_value function can read it to be displayed. What I haven't found is the code that is updating the table.

--------------- Added [DATE]1281036061[/DATE] at [TIME]1281036061[/TIME] ---------------

I finally resolved my problem by finding the import_user function in the ImpExDatabaseCore.php file (not to be confused with the deceptively similar function in ImpExDatabase.php) and added the loginname field to the sql update statement.

Now I get to move on and deploy my blind loginname hack and test it with the imported userdata.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:24 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03420 seconds
  • Memory Usage 2,172KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete