Table of Contents
The Goal
This entry explains how I converted a 700 members Postnuke site to Expression Engine. I don’t discuss site design since it’s not important to the conversion process. Perhaps seeing what I did will help you with a similar conversion. This process worked for me, but even if your conversion is PN to EE, it will probably need massaged a bit for your situation. Some particulars:
Versions:
* PostNuke 0.7.5.0 with pnForum 2.0.1
* EE 1.3.2 with Discussion Forum 1.1.1
To be moved from PN to EE:
* Member/user accounts (700)
* Articles (60)
* Area directory (links module) (70)
* Forums (5000 posts)
There were other parts of the site that were new and created from scratch, so no conversion was needed.
The Process
BACK UP ALL DATA FILES!
Step 1a Convert members using Excel
My first cut at this was somewhat manual. The idea was to use Excel to manipulate data from PN and put it into EE tables. The process I followed is outlined below for those who like pain, but before using it, skip down to Step 1b. You should be able to avoid this pain!
Export the following tables to CSV format using phpMyAdmin:
* nuke_users (from PN)
* exp_members (from EE)
* exp_member_data (from EE)
* exp_member_homepage (from EE)
Open nuke_users.csv and exp_members.csv in Excel and copy the following:
* pn_uid to member_id
* pn_uname to username & screen_name
* pn_pass to password
* pn_email to email
* pn_user_from to location
* pn_user_occ to occupation
* pn_user_intrest to interests
* pn_user_regdate to join_date and last_visit
* Notes:
** I ensured there was no member ID 1 from PN (EE administrator account)
** Password is MD5, but EE will convert to SHA1 the first time the user logs in if EE is set for SHA1 encryption
** There were a few others I could have copied over, but I chose a minimalist approach
Prep EE CSV files
* exp_members.csv
# set group_id to 5 (Members group)
# set unique_id to 40 character hex code (http://www.elfqrin.com/pwgen.html—> store in advance)
# set ip_address to 1.1.1.1
# set remaining fields to the same as newly registered member
# delete header & rows exported from EE
* exp_member_data.csv
# copy member_id’s from exp_members.cvs to member_id
# delete header & rows exported from EE
# exp_member_homepage.csv
# copy member_id’s from exp_members.csv to member_id
# set remaining fields to the same as newly registered member
# delete header & rows exported from EE
* Notes:
** I had to change a few group_id’s since I had a few banned members
*** The unique_id was tedious…better to use a PHP script that spits out however many you need
*** Old versions of PN did not store registration dates, so I just defaulted something in EE
For each EE CSV file insert into EE table using phpMyAdmin:
# select table
# select “Insert data from a text file into the table” at bottom of page
# browse to CSV file
# set “Fields terminated by” to a comma
# select “Fields enclosed by” “OPTIONALLY” check box
# submit the form
# repeat for each of three tables
By the way, see PHPBB Import for more information on using a spreadsheet with CSV files to convert information.
Step 1b Convert members using script
The above manual process worked fine, but I decided I wanted a faster way to update it when it was time to go live, so I wrote a script to do that. If I were doing it over again, I would just use the script to do the entire conversion. Though it was written to update EE with new registrations, it should actually work fine doing the entire conversion, assuming there is only member id 1 in EE and no id 1 in PN. Here’s what I did:
BACK UP ALL DATA FILES!
# Upload File:add pn users.txt script to server
# Load add_pn_users.php from browser
That’s it. The script was designed so that it could be run periodically even before going live, but I wanted the passwords to be whatever they were at the time of the final conversion. So the script updates the password of any already transferred users prior to pulling in new ones. The script gives more details. Oh…one other thing. Because most of my members had already been converted, I set the script to default to the Pending group and then manually set those who I had approved to the Members group. You may want to change the default.
Step 2 Convert stories or news and area directory
Frankly, this part was totally manual. I created new weblogs for each section of the new site. Other than the forums module, everything I had in PN was recreated using a weblog with custom fields in EE, including FAQ’s and an event calendar that I did not bother converting (started fresh). The two that I thought about converting were the “Stories/News” section and the “Area directory” section.
The stories section only had about 60 articles in it. I found that I could copy-and-paste them, set the correct date, etc., fairly quickly, and since there were only a few comments that I didn’t care about, this was how I moved them. It took less than 2 hours.
The area directory section was a little bigger, but here I had a problem. In PN this was created using a links module. All it really had was a place for the link, a title, and a description field. In EE I wanted to allow entries that did not have a web site, plus I wanted separate fields for addresses, hours, etc., much of which was buried in PN’s one description field. So, once again I used copy-and-paste to get the data moved over. It took about 3 hours.
If you have a lot of articles you will probably want to write a script to handle that part of things. Being pragmatic (and not really a programmer), and having a fairly small number, this manual process was fine. The forums were another matter!
Step 3: Convert forums
# Create new forum structure
Part of my conversion included minor changes in forum structure, but even if the structure is to remain the same, I strongly advise setting it up manually in EE as it avoids any possibility of missing something, and eases the conversion process. So I created my forum categories and forums using EE but did not make ANY entries in them. I then matched up the EE forum numbers with the PN forum numbers and mapped them in the script.
BACK UP ALL DATA FILES!
Convert forums from PN to EE
# Import nuke_pnforum_topics, nuke_pnforum_posts, and nuke_pnforum_posts_text to EE database
# Ensure that exp_forum_topics and exp_forum_posts tables are empty
# Upload File:convert forums.txt and run from browser
# Re-sync forums in forums management area (just a precaution)
# Recount all stats in admin utilities
That’s it! Of course these scripts would need modified before anyone could use them, but they’re heavily commented to make that easier.
