News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Export registration information to alternate database

Started by duckydanfrb, October 13, 2009, 12:06:51 PM

Previous topic - Next topic

duckydanfrb

I am looking to export the information from a custom field required on registration to a second database.  I am running an xbox achievement forum and on registration I am asking for the users XBL Gamertag.  I would like to export this information to a table called XBL as well as have it continue going to the smf_custom_field table for SMF to continue working.  How can I do this without too much hassle?

Aleksi "Lex" Kilpinen

Moved this from 2.0 support to coding discussion, where it may get better responses.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Dragooon

Well there are 2 ways that I can think of offhand, first is modify the profile updating/register or whatever functions that deal with custom profile field's editing and make them append to the XBL table. Other is periodically run a scheduled task(say every 6 hours) that appends all the new XBL data. The latter might be more complex as it will be required to load which data to append(I am not sure how Custom profile field's data is stored so can't say whether it will be much more complex or not more complex at all).

Arantor

Quote from: Dragooon on October 20, 2009, 11:38:36 AM
(I am not sure how Custom profile field's data is stored so can't say whether it will be much more complex or not more complex at all).

It's in the {$db_prefix}themes table, one row per user per custom field entry.
Holder of controversial views, all of which my own.


Dragooon

Quote from: Arantor on October 20, 2009, 11:43:37 AM
Quote from: Dragooon on October 20, 2009, 11:38:36 AM
(I am not sure how Custom profile field's data is stored so can't say whether it will be much more complex or not more complex at all).

It's in the {$db_prefix}themes table, one row per user per custom field entry.
OK so that pretty much declares using scheduled task for this as a totally bad idea. I guess your only option is to modify the function that append/edit the function that edits the data...On the bright side one functions handles it all(Profile-Modify.php - makeCustomFieldChanges) if I get this right, so this shouldn't be much of a hassle.

duckydanfrb

I looked into it and the information for the custom field was being stored in the smf_themes table.  What I did was on the page I needed that information just made a script that would call smf_themes where variable = "NameOfField" and exported value to the new table to do the leaderboard.  It works well but it was a pain to code (and not as easy as just a simple export)

Arantor

Does your export use a simple SQL query to get the data from the members table? It wouldn't be a pain to use a LEFT JOIN onto the themes table.
Holder of controversial views, all of which my own.


duckydanfrb

I don't know SQL that much so I'm using a multi-string command to get the info I need:

   $query = "SELECT * FROM `smf_themes` WHERE variable='xboxliv'";
   $query2 = "SELECT * FROM `smf_themes` WHERE variable='xboxliv' ORDER BY GS DESC";

(GS is the xboxliv gamerscore which I brought in via another query earlier in that page)

Advertisement: