OK, I’m referencing the tail end of this thread called “Member Import doesn’t respect email uniqueness setting?” in which the discussion turned to importing members. I would have posted these questions there, but they make more sense in this thread, because the title is more accurate. Onward…
We will be attempting to import (read: insert) these members right into mySQL. We pared it down to 380,000 records, but that is still way too many for the built-in XML import utility and PHP to handle. I have a developer who can write a script and/or use a program to generate what needs generating for the fields, but I want to ensure we’re doing this in a way EE can use. I guess I have a few questions relating to this:
1. The unique_id field and generating that ID
How do we generate this? Can we use the same “random” function that is in cp.member_import.php around line 714?
/** -------------------------------------
/** Add a unique_id for each member
/** -------------------------------------*/
$data['unique_id'] = $FNS->random('encrypt');
which is referencing “function random” in core.functions.php, line 367:
function random($type = 'encrypt', $len = 8)
{...
}
I just want to make sure the unique_id we generate can be ‘used’ by EE. Does it need to be a certain amount of characters, etc.
2. member_id and Duplicates
The site is live now (yay!), and people are registering as members as I type this. If we were to go and insert these 380,000+ records, I’m assuming that for our automated insert process we can just start the member ID at something like 10000 and have it increment from there. The question I have on that is: everyone registering up to member #9999 should go in without incident, but will the next member registration then automatically jump to member_id #390000? I’m just making sure that the member ID will look for the next available open number and use that.
3. Password Encryption
This is similar to question 1. Do we HAVE to hash this? Or can we keep it simple and just import the password as typed? cp.member_import.php around line 586:
case 'password':
// encode password if it is type="text"
$this->members[$i][$tag->tag] = ($tag->attributes['type'] == 'text')
? $FNS->hash($tag->value) : $tag->value;
break;
which is referencing “function hash” in core.functions.php, line 327:
function hash($str)
{...
}
I don’t recall what hash setting they used by default when they installed. What’s the easiest way to figure that out from the CP?
4. The Database Tables to Insert Into
Need to make sure we hit and insert into every table that a new member goes into. I think this list is complete:
exp_members
exp_member_data
exp_member_homepage (even though these people will never see this, I’m assuming a record with their member_id needs to be inserted here as well)
Any advice or experience with importing members through directly inserting them would be much appreciated. Thanks!