Importing LJ entries with threaded comments into WordPress

This guide is based off of Heinous.org's LiveJournal XML Export Script guide.

What You Need

 * Hosting that has SSH capabilities, along with the ability to run Perl scripts.
 * An SSH client. If you're on Windows, you can use PuTTY.  If you're on OS X, you can use Applications -&gt; Utilities -&gt; Terminal.app to SSH and there is a guide here.

Some Terminology
There are a few commands that you need to know to get around on your web host using the command line.

List directories:  will list the contents of the current directory you are in.

Your current directory:  will echo the current directory you are in.

Change directory:  will change your current directory into DIRECTORY. If you want to go up a directory, use. If you want to go to your home directory, use. Let's say you used the  command and see a directory named wordpress. You can  to change into that directory.

Installing Brian's Threaded Comments
Brian's Threaded Comments is a plugin that will make WordPress comments threaded. The plugin distribution can be downloaded here:

http://meidell.dk/files/briansthreadedcomments15.zip

To install it all from the command line, SSH into your web server and go into your WordPress directory. Then enter each of these commands:

cd wp-content/plugins wget http://meidell.dk/files/briansthreadedcomments15.zip unzip briansthreadedcomments15.zip rm briansthreadedcomments15.zip rm install.txt cd .. mv themes/default/comments.php themes/default/comments.php.bk mv plugins/comments.php themes/default/comments.php

You then need to go to your Plugin page. Login at the  page and click the Plugins link on the Dashboard bar. You should see "Brian's Threaded Comments" with a version of 1.5.7 listed under the Plugin Management section. Click on the "Activate" link to activate the plugin for your WordPress install.

If you have deleted the first welcome post WordPress makes, create another post with a test comment. Then reply to that comment with the "Reply to this comment" to test and make sure everything is working. (Warning: JavaScript needs to be enabled for this.) If you do not do this, you may receive errors when trying to import threaded comments.

Installing Live+Press and Patching Class-IXR
Start out in your Wordpress directory and perform the following commands:

cd wp-content/plugins mkdir tmp cd tmp wget http://www.creepigurl.com/wp-content/uploads/2007/05/livepress_1999.zip unzip livepress_1999.zip mv LivePress_1.99.9 .. cd .. rm -rf tmp cd ../../wp-includes cp class-IXR.php class-IXR.php.bk wget http://heinous.org/files/scripts/wordpress-lj/class-IXR.php.patch cat class-IXR.php.patch | patch -p1 class-IXR.php

You will get an error that says "missing header for unified diff at line 3 of patch". Don't worry, it still worked.

Activate the "Live+Press" Plugin from the Plugins page. Log out of WordPress and back in (as admin again). Go to the "Options" tab on the Dashboard and then to the "Live+Press" options below the main set of tabs. You can then configure Live+Press how you like.

Downloading your journal with the modified jbackup.pl
Start out in your WordPress base directory and run these commands:

mkdir ljsync chmod 700 ljsync cd ljsync wget http://heinous.org/files/scripts/wordpress-lj/jbackup.pl

If you want ALL entries to be downloaded, regardless of their security level, run this command:

./jbackup.pl --user=username --password=secret --sync -dump=xml > backup.xml

If you only want PUBLIC entries to be included, run this command:

./jbackup.pl --user=username --password=secret --publiconly --sync -dump=xml > backup.xml

This will make a back up of your journal with all comments in it. Warning: It is unknown whether the  option will exclude screened comments!

Replacing WordPress's default importer
Start in your base WordPress directory and run these commands:

cd wp-admin/import mv livejournal.php livejournal.php.bk wget http://heinous.org/files/scripts/wordpress-lj/livejournal.php.txt mv livejournal.php.txt livejournal.php

Importing the backup
Fetch the  file from your [WPDOMAIN]/ljsync/ directory to your computer.

Go to the "Import" section in the WordPress and click on "LiveJournal" in the list. The next page will request you to upload the file you just downloaded. Click the Browse button and select it.

You can then press the "Import" button.

If it doesn't work, go to your WordPress directory and try running the following command:

chmod g+rw -R wp-content/uploads

And try repeating the import instructions.

If that doesn't work, go to your WordPress directory and try running the following command:

chmod o+rw -R wp-content/uploads

WARNING: This is not the most secure method of importing--it's possible to access the directory from the web this way. After you are done, you might want to go to your base WordPress directory and run the following command to remove  from the uploads directory:

rm wp-content/uploads/backup.xml

Your LiveJournal should be uploaded to your WordPress now. Go check and make sure everything transferred correctly.

Deactivate Live+Press
So far, I've had strange errors when trying to write or edit posts on WordPress with Live+Press activated. You can go to the Dashboard and deactivate it in the Plugins section without ruining your import.