Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-02-19 04:01:40

mistersugar
Member
From: North Carolina
Registered: 2004-04-13
Posts: 141
Website

Export comments, then import into Disqus

After neglecting my blog at mistersugar.com (where I’ve run Textpattern since 2004) for too long, I’m making improvements. I’ve switched my comments to Disqus, but now am stuck trying to find a way to export previous comments so that I can then import them to Disqus. Anyone have experience doing this?

I’m following http://nathanpitman.com/migrating-from-txp-to-ee-step-2/ but don’t know how this might lead me to a Disqus import.

Thanks for any help.

Offline

#2 2011-02-22 17:57:40

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Export comments, then import into Disqus

I am looking at doing the same thing for one of my blogs. The initial setup was easy – doing the existing comment import seems to be the time consuming part.

I found the generic Disqus Import Format: Comment Importing

I am thinking combine that with How-to : Generate a comments RSS feed and we have everything we need.

It is just a matter of taking the time to do it.

Offline

#3 2011-02-23 14:38:25

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: Export comments, then import into Disqus

Why don’t you just leave the current comments where they are, switch off commenting, delete the comment form and inject the Disqus code below/above the ‘show comments’ code?


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#4 2011-02-23 17:58:15

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Export comments, then import into Disqus

merz1 wrote:

Why don’t you just leave the current comments where they are, switch off commenting, delete the comment form and inject the Disqus code below/above the ‘show comments’ code?

That would probably work for me, but it seems like actually doing a full integration is better in the long run.

I made a temporary section called disqus and created the page disqus to go along with it. Notice that all my articles were in a section called blog rather than article or wherever yours likely are. You will probably need to edit that.

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:dsq="http://www.disqus.com/"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wp="http://wordpress.org/export/1.0/">
<channel>
<txp:article_custom limit="99999" section="blog" form="disqus-article" />
</channel>
</rss>

disqus-article article form

<txp:if_comments>
<item>
      <!-- title of article -->
      <title><txp:title no_widow="0" /></title>
      <!-- absolute URI to article -->
      <link><txp:permlink /></link>
      <!-- thread body; use cdata; html allowed (though will be formatted to DISQUS specs) -->
      <content:encoded><![CDATA[<txp:body />]]></content:encoded>
      <!-- value used within disqus_identifier; usually internal identifier of article -->
      <dsq:thread_identifier><txp:article_id /></dsq:thread_identifier>
      <!-- creation date of thread (article), in GMT -->
      <wp:post_date_gmt><txp:posted gmt="1" format="%F %T" /></wp:post_date_gmt>
      <!-- open/closed values are acceptable -->
      <wp:comment_status>closed</wp:comment_status>
<txp:comments form="disqus-comments" wraptag="" break="" />
</item>
</txp:if_comments>

disqus-comments comment form

      <wp:comment>
        <!-- internal id of comment -->
        <wp:comment_id><txp:comment_id /></wp:comment_id>
        <!-- author display name -->
        <wp:comment_author><txp:comment_name link="0" /></wp:comment_author>
        <!-- author email address -->
        <wp:comment_author_email><txp:comment_email /></wp:comment_author_email>
        <!-- author url, optional -->
        <wp:comment_author_url><txp:comment_web /></wp:comment_author_url>
        <!-- comment datetime, in GMT -->
        <wp:comment_date_gmt><txp:comment_time format="%F %T" /></wp:comment_date_gmt>
        <!-- comment body; use cdata; html allowed (though will be formatted to DISQUS specs) -->
        <wp:comment_content><![CDATA[<txp:comment_message />]]></wp:comment_content>
        <!-- is this comment approved? 0/1 -->
        <wp:comment_approved>1</wp:comment_approved>
        <!-- parent id (match up with wp:comment_id) -->
        <wp:comment_parent>0</wp:comment_parent>
      </wp:comment>

Then I just browsed to the section, viewed the source, and deleted all the extra page generation stuff down at the bottom. Went to disqus.com and did the import. It seems to have worked correctly – the comments show up in the interface and on the site. Then delete the disqus section and call it a day.

Note: The Textpattern comment_time tag doesn’t support GMT format according to the Wiki. I didn’t really experiment with that, because it wasn’t critical for me. Also, I was missing a bracket on the comment_author_email so all of mine got slightly munged – the one above should work correctly, I hope.

Last edited by michaelkpate (2011-02-27 13:33:59)

Offline

#5 2011-02-24 10:55:36

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: Export comments, then import into Disqus

Then delete the disqus section and call it a day.

Congratulations!

Michael that’s a good one for TXP tips > Submit a tip

Edit: Added it to my Zotero Textpattern library. Feel free to join.

Last edited by merz1 (2011-02-24 11:06:48)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#6 2011-02-24 14:21:33

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Export comments, then import into Disqus

merz1 wrote:

Congratulations!

It was really pretty simple once I understood what the XML was looking for and it was pretty well documented. The trickiest part was figuring out some of the tag attributes – like what you can and can’t do with txp:comments.

Oh, and I now stalking you on Zotero.

Offline

#7 2011-02-24 14:39:50

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: Export comments, then import into Disqus

On my blog, authors have their custom color comments (set with CSS) different from readers comments: could I set them in the same way using Disqus?

Offline

#8 2011-02-24 18:41:01

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Export comments, then import into Disqus

candyman wrote:

On my blog, authors have their custom color comments (set with CSS) different from readers comments: could I set them in the same way using Disqus?

I haven’t tried it myself but this article seems to indicate a method: Disqus: Highlight Author and Moderator Comments

Offline

#9 2011-02-24 19:24:29

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: Export comments, then import into Disqus

Thanks, I’ve missed that! I hope it’s compatible with the free account… :/ I’ll give a try after the comments migration.

Offline

#10 2011-02-27 05:42:51

ardianzzz
New Member
Registered: 2010-03-31
Posts: 4
Website

Re: Export comments, then import into Disqus

Someting wrong with this code: <txp:comment_web> ;)

Offline

#11 2011-02-27 08:57:22

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Export comments, then import into Disqus

ardianzzz wrote:

Someting wrong with this code: <txp:comment_web> ;)

Should be <txp:comment_web />


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#12 2011-02-27 13:35:42

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Export comments, then import into Disqus

Yes – it should have been indeed. And I just fixed the original.

Not surprised I made the mistake – do that sort of thing all the time – but I am surprised I didn’t notice it before because that sort of thing usually seriously breaks the output.

Offline

Board footer

Powered by FluxBB