You are viewing the PKP Support Forum | PKP Home Wiki

importing old users

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

importing old users

Postby bunswo » Fri Oct 14, 2005 1:23 pm

I was wondering if you could tell me the best way to import old users from OJS 1 to OJS 2.1

I only really need their names, usernames, email and password... and the only thing I guess I'm not quite sure how to do is retain the passwords. I figure I can just export the fields with PHP MyAdmin into an excell sheet and then reformat it to correspond to the new fields in the new version. What I'm not sure about is if the old user passwords will still work?

Posts: 6
Joined: Mon Aug 15, 2005 1:57 pm

Postby asmecher » Mon Oct 17, 2005 3:07 pm

Hello Ben,

The method used to store passwords in OJS has changed since 1.x. OJS 1.x used MySQL's ENCODE and DECODE functions to store passwords, while OJS2 uses MD5 or SHA1 (as configured in config.inc.php, with MD5 as the default).

You can extract the passwords from OJS 1.x as follows:
1. Get the password salt from MySQL:
Code: Select all
SELECT chPasswordSalt FROM tbljournalconfig;

2. Use the password salt to get the passwords.
Code: Select all
SELECT chUsername, decode(chPassword, '(salt goes here)') AS password FROM tblusers;

If OJS 2.x is configured to use MD5 hashing for passwords, you can use MySQL's md5(...) function to generate the new password hash. Concatenate the username and password and generate the hash. For example:
Code: Select all
UPDATE users SET password=md5(concat(username, '(new password goes here)')) WHERE username='(username goes here)';

An easier way to accomplish all of this is to use the migration tools to bring an entire OJS 1.x journal into OJS 2.x; however, this will also bring across the journal settings, articles, submissions, etc, so you'll have to clean up afterwards if all you want is the users.

Alec Smecher
Open Journal Systems Team
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest