Store
Community Documentation

v3 Knowledgebase

Information on how to build an import script for users

If you are planning on importing users from a 3rd party script there are certain fields that are required. Below we list all the required fields to create a successful import of users from a 3rd party script.

There are 5 tables that require a record for each user. The main table is:
user

This creates the unique ID for each user. The remaining 4 tables uses the unique ID created by the "user" table:
Quote:

user_activity
user_field
user_space
user_count

First, we need to successfully create a unique ID and to do this we require the following fields for the user table:
Quote:

user_group_id (Holds the users group ID, which by default is 2)
full_name (Full Name or Display Name of the user)
email (Email of the user)
joined (Unix time stamp of when the user joined)

Another field we require is:
user_name

This field holds the vanity URL. It must be unique as this what we use to visit a users profile. Only alphanumeric characters can be used and the underscore:
A-Z0-9_

If you are unable to get a user name you can use a users full name/display name and remove any unwanted characters or use their unique ID#, which can be updated after inserting the user into the "user" table.

The final field we require for this table is the password. It is split up into 2 fields:
Quote:

password
password_salt

The field:
password

holds a 32 character salted MD5 hashed version of their password. In order to get this value we use the following PHP code:
PHP:
md5(md5($sPassword) . md5($sSalt)); 

The variable:
PHP:
$sPassword 

holds the users password. The variable:
PHP:
$sSalt 

holds a random set of characters. The PHP function we use is:
PHP:
function getSalt($iTotal 3)
{
     
$sSalt '';
     for (
$i 0$i $iTotal$i++) 
     {
         
$sSalt .= chr(rand(3391));
     } 
     return 
$sSalt

For the field:
password_salt

we input the value for the salt we created earlier and used in the MD5 hash.

Once you have inserted the information to the database it should return a unique ID#. This number will be used to insert information for the remaining tables:
Quote:

user_activity
user_field
user_space
user_count

With the ID# we now have, insert that ID# into the field:
user_id

for each remaining table.