• timyang

    Hi
    Can we import Dotcomments into WordPress? If so, how do we do that?
    Thanks!
    Tim

Viewing 3 replies - 1 through 3 (of 3 total)
  • i have comments already on my blog using another comments feature, is there a way to import them easily? there all stored in txt files on my server.
    Thanks
    Chris (www.vandango.co.nr)

    If you are importing from a Blogger site that uses dotcomments, following the steps below will allow you to import the comments along with the Blogger posts. (No guarantees it will work; it worked for me so I figured I’d post it here in case it’s helpful to others.)

    First, copy the “comments” directory that exists in the root of your old (blogger) site to the root of your new (wordpress) site. Then, add the following code to wp-admin/import-blogger.php right after where it performs the SQL insert for the post (line 148 in the version i’m using). Then perform the blogger import like you normally would; the comments should be included.

    The code:


    //========= Import comments ========

    // get the post id for the row that was just inserted:
    $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date' AND post_content = '$post_content'");

    // get the comments file and iterate over each comment within:
    if(file_exists("../comments/$postinfo[3].comment")) {
    $comments = file("../comments/$postinfo[3].comment");
    for($j = 0; $j < sizeof($comments); $j++) {
    // split the comment line into parts:
    $thisComment = explode('[+]', $comments[$j]);
    $comment_author = $thisComment[1];
    $comment_email = $thisComment[2];
    $comment_content = $thisComment[3];
    $comment_url = $thisComment[4];
    $comment_date = date('Y-m-d H:i:s', $thisComment[0]);

    // perform the database insert:
    $wpdb->query(
    "INSERT INTO $wpdb->comments (
    comment_post_ID,
    comment_author,
    comment_author_email,
    comment_author_url,
    comment_date,
    comment_content,
    comment_approved
    ) VALUES (
    $post_id,
    '$comment_author',
    '$comment_email',
    '$comment_url',
    '$comment_date',
    '$comment_content',
    '1'
    )"
    );
    }
    }

    Any updates on how to use this with the latest WP 2.0 import script?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Dotcomments’ is closed to new replies.