10.13.2012

Fixed: All Disqus Comments have the Same Author Name

I recently decided to use Disqus to handle comments on my new Wordpress site. I installed the Disqus Wordpress plugin and imported my comments. After I did this, I found that all the comments on each of my posts had the same author name. I spent the last few days fixing this problem. Here is how I did it.

The problem stemmed from the fact that all the commenters on my blog had the same email address. This was because I originally imported my posts from a Blogger blog using the Blogger Importer Wordpress plugin. Blogger sets the email addresses for all its comments to "noreply@blogger.com." When Disqus reads this, it interprets each comment as coming from the same person, and displays the first commenter's name for all the comments on a given post. It doesn't appear this way in the Disqus admin panel, but stupidly, it does on the site where you embed your comments.

Here are the steps I took to fix this:

1. Exported all my Wordpress content under Wordpress admin > Tools > Export. This will generate a WXR file (with an "xml" file extension).

2. Downloaded a text editor called Emacs. I was using Windows XP, so I downloaded this: http://ftp.gnu.org/pub/gnu/emacs/windows/emacs-24.2-bin-i386.zip

3. Extracted the Emacs zip file to a folder. Launched \bin\runemacs.exe and opened my WXR file from Step 1. Went to Edit > Replace > Replace Regexp. For the query to replace I typed in "noreply@blogger.com" and hit Enter. For what to replace it with I typed in "noreply\#@blogger.com" and hit Enter. Then I typed "!" to tell Emacs to make the change for the entire file.

This code, "\#", tells Emacs to search and replace each result it finds with a number, starting at 1, that increments with each replace. After Emacs was done I had a file that instead of "noreply@blogger.com," was filled with "noreply1@blogger.com," "noreply2@blogger.com," "noreply3@blogger.com," etc. Presto! A file full of Wordpress comments where all the commenters have unique email addresses (I learned how to do this here). I saved the file.

4. The next step was to create a new forum on Disqus (Disqus.com > Dashboard > Add+). Once it was created I went to Tools > Import > Upload WXR and uploaded my new WXR file.

5. I periodically checked import.disqus.com until it reported that my import was complete (this took about 24 hours). Then I went into Wordpress admin > Comments > Advanced Options and changed my Disqus shortname to the shortname of my new forum. Saved changes and I was done!

I think it would be very easy for Disqus to prevent its users from having to go through all these hoops. Since they don't I figured I would do my part to prevent others from having to go through the same frustration I did.

One last tip: make sure you don't change any of your post URLs between the time you export your Wordpress site and when you import it into Disqus. If you do, you will have to use Disqus' Migrate Threads tool to fix your URLs. 

No comments:

Post a Comment