Forum

Thread tagged as: Question, Members

Import members

Hi, is it possible to import existing members into the members app?

Jon H

Jon H 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, it's possible, but there's no built in functionality to do it. It can be done by writing the data directly to the MySQL database table.

What's the source you're dealing with?

Jon H

Jon H 0 points

The member are stored in an access database, so could be exported as CSV file.

Added my comment here so I get email updates as we will also want to do this. And will the members system cope with 5000 (currently, but growing) members?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are passwords currently encrypted, Jon?

Graham, there's no limit really.

Jon H

Jon H 0 points

Passwords aren't currently encrypted.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, that's useful. It means they can be encrypted on import and everyone would get to keep their password.

So yes, it's possible. There's no code to do it, but you could script it yourself, or have us do it for you - we would treat it like a one-off update: https://grabaperch.com/hands-on/#package2

Jon H

Jon H 0 points

I have imported the members into the database, How do I encrypt the passwords so the existing passwords can be used with Perch?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Provided you have included the Perch runtime, like this:

$Hasher = new PasswordHash(8, true);
$encrypted_pwd = $Hasher->HashPassword($clear_pwd);
Jon H

Jon H 0 points

Thanks. Other than adding login credentials to the perch2_members table (password encrypted as instructed above) is there anywhere else within Perch that the details need adding?

Jon H

Jon H 0 points

Fixed. memberExpires had '0000-00-00 00:00:00'. Updating to NULL seems to have fixed the problem.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Great!

Drew, where does that snippet of code go? also if there were spaces in the password how would that be interpreted?