gregstoll/ljtowordpress

Preserve the name of the author of comments

asuh opened this issue · 10 comments

asuh commented

I've tried to go through the file and figure out how to preserve the name of the comment authors who aren't the journal author and I'm not sure what to do.

Is it non-trivial to preserve the comment authors' names?

I think this is the only missing and somewhat important feature that needs to be added to this script. Otherwise, it works exactly as it should from my testing.

That's a good question :-) LJBackup does capture the username of comment authors, and I thought the script handled that well. Do you mean comment authors that don't have an LJ account?

asuh commented

Strange, no comments preserved the author names after I imported the xml. Every comment is left by "Anonymous", even the ones I wrote. Are you seeing different results?

Weird - yeah, my posts have the author's name (see this post for a quick example. Look in your LJ XML file for lines like this:

  <comment posterid='4532903' username='wonderjess' date='2016-11-16T01:44:53+00:00'>

The username should be the LJ username and the posterid is their LJ ID. What do yours look like?

asuh commented

Yes, all of the XML information, including the LJ username, posterId, and LJ ID, was corrected saved and appears to be there. It was the process of converting them to WP data that it didn't transfer the author names to the comments.

Hmm, OK. In the WordPress XML, then, you should see some <wp:comment> elements that have a <wp:comment_author> child, like so:

  <wp:comment>
    <wp:comment_id>1</wp:comment_id>
    <wp:comment_author>djedi</wp:comment_author>
    <wp:comment_author_url />
    <wp:comment_author_IP />
    <wp:comment_date>2016-10-03 22:17:38</wp:comment_date>
    <wp:comment_date_gmt>2016-10-03 22:17:38</wp:comment_date_gmt>
    <wp:comment_content>a comment</wp:comment_content>
    <wp:comment_approved>1</wp:comment_approved>
    <wp:comment_type />
    <wp:comment_parent>0</wp:comment_parent>
  </wp:comment>

Do the comments in the XML file have their author as "Anonymous"?

asuh commented

Well that would explain it. None of my comments have the line <wp:comment_author>. They skip from the ID to the URL. I'm not sure why the author name wasn't converted from allPosts.xml file where they do exist.

It skips the <wp:comment_author> if it doesn't see a username in the comment in the LJ XML file. So can you post a <comment> element from your LJ XML file? I'm at a bit of a loss here...

asuh commented

Here's an example of comments throughout the xml file.

    <comments>
      <comment posterid='10113733' username='abcd' date='2009-11-18T00:35:49+00:00'>
        <body>
          &quot;Man, you read about it but don&apos;t get it until it happens to
          you.&quot; See? ;)
        </body>
        <replies>
          <comment posterid='1807965' username='efgh' date='2009-11-18T05:09:53+00:00'>
            <body>
              I&apos;ve read of reverse culture shock before but it&apos;s weird
              to experience first hand!
            </body>
          </comment>
        </replies>
      </comment>
    </comments>

Thanks for the example! I don't know why the script wasn't detecting the usernames in your file and was in mine, but I fixed the issue in commit aad3cad.

asuh commented

Nice, I'll give that a try and report back if there's any other issues.