Joomla / JomSocial - Import users from Geeklog / GLFusion
If you wish to convert your Geeklog site to the Joomla platform, then you will have a number of things that you will need to do. First off, you will need to get a copy of Joomla up and running. In my case, I am using JomSocial, but the process is the same for both JomSocial and Joomla installations.
To perform this migration you will need to use a database management tool to run SQL statements. I use phpMyAdmin, which is usually bundled with most hosting packages, but you could easily use any other similar tool for this.
Once you have your Joomla install set up, you will need to make a backup of the following table on your Geeklog site
To do this using phpMyAdmin, simply navigate to the table and then go to the export tab. Check the 'save to file' checkbox and then save the backup to your local computer.
Next you will need to add this table to your Joomla database. To do this using phpMyAdmin, navigate to your Joomla database and then hit the import tab. Browse to the file you just saved and then hit the 'go' button. You should now be able to see the gl_users table in your joomla database.
The reason for copying this is simply to make copying the fields easier. If you are only using one database with both the Geeklog and Joomla info in it, there is no need to do this
Now for the exciting part...
The main issue with user migration between platforms, is the multitude of different authentication methods used, Joomla uses a salted password, where the password is stored in the following format
Fortunately for us, it still works if we leave the salt off. This is great news as it means we can simply copy our MD5 hashed Geeklog passwords straight across without having to do anything to them.
All that it left to do now, is to map the Geeklog database fields to their corresponding Joomla database fields, and construct an SQL statement to perform the migration.
The Joomla database table that contains the user data is
But there are two other tables that we need to consider. These contain the user permissions data, and without corresponding entries, users will not be able to log in. These table are
Important things to remember are that we need to maintain the same ID field as the Geeklog table, the user ID is used to reference all content, in the geeklog gl_users table this is the `uid` field. Same with the username and password fields. It is really only these three fields that are needed to get everything up and running.
So, putting all of this together, we end up with the following SQL statements.
To migrate the user data, first you will need to empty the existing data from the tables, to do this in phpMyAdmin, simply navigate to the table and then selet the 'Emtpy' tab. Just in case something goes wrong, make sure you take a backup of everything BEFORE you try any of this, then you can proceed with the migration.
To populate jos_users table
insert into jos_users (id, username, name, password, usertype, gid, email, registerDate) SELECT uid, username, fullname, passwd, 'Registered', '18', email, regdate from gl_users
To populate jos_core_acl_aro table
insert into jos_core_acl_aro (section_value, value, name) select 'users', id, name from jos_users;
To populate jos_core_acl_groups_aro_map
insert into jos_core_acl_groups_aro_map (group_id, aro_id) select '18', id from jos_core_acl_aro;
This will set all users as normal registered users. Assuming that you're site is like mine, and that you only have one or two admins, it's easy enough to manually change users into administrators. To do this you will need to change both the jos_users table and the jos_core_acl_groups_aro_map table.
In `jos_users`, change the `user_type` field to 'Super Administrator', and the `gid` field to '25'
In `jos_core_acl_groups_aro_map`, change the `group_id` field to '25'
You should now be able to log into your site using your Geeklog log in details, and also log in to the administration panel using your administrators log in details.
If you are a JomSocial user and you would also like to copy across your user avatars, you can use the following SQL statements
To copy the user avatar image info...
INSERT into jos_community_users (userid, avatar, thumb) SELECT uid, photo, photo FROM gl_users
To convert the image data to include the correct path (for only those users who have an avatar)...
UPDATE jos_community_users set avatar = CONCAT('images/avatar/', thumb) WHERE thumb not like null
Now, simply copy the avatars into your images/avatar folder.