From a70cbed1d01ddfc56038720a3e7c1d81a4b9dc14 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 11 May 2009 20:16:54 +0000 Subject: Import comments. This was a lot easier than I thought it would be --- modules/g2_import/helpers/g2_import.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'modules/g2_import/helpers') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index ee3dd61e..3ba37c86 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -306,6 +306,25 @@ class g2_import_Core { static function import_comment(&$queue) { $g2_comment_id = array_shift($queue); $g2_comment = g2(GalleryCoreApi::loadEntitiesById($g2_comment_id)); + + $text = $g2_comment->getSubject(); + if ($text) { + $text .= " "; + } + $text .= $g2_comment->getComment(); + + // Just import the fields we know about. Do this outside of the comment API for now so that + // we don't trigger spam filtering events + $comment = ORM::factory("comment"); + $comment->author_id = self::map($g2_comment->getCommenterId()); + $comment->guest_name = $g2_comment->getAuthor(); + $comment->item_id = self::map($g2_comment->getParentId()); + $comment->text = $text; + $comment->state = "published"; + $comment->server_http_host = $g2_comment->getHost(); + $comment->save(); + + self::map($g2_comment->getId(), $comment->id); } /** -- cgit v1.2.3