From 1d2bcc1332cdc501e2ec92f6755869d4a0804bb2 Mon Sep 17 00:00:00 2001 From: Kevin Deldycke Date: Tue, 26 Apr 2011 12:46:35 +0200 Subject: [PATCH] Some replies are attached to a nonexistent parent. In this case, promote them as Topics. --- e107-importer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e107-importer.php b/e107-importer.php index ebf015d..1cbae41 100644 --- a/e107-importer.php +++ b/e107-importer.php @@ -1091,10 +1091,11 @@ function import_forum_thread($thread) { // Top message of threads are topics, attached to a forum. // Others are replies, attached to a topic. - if ($thread_parent > 0) { + if ($thread_parent > 0 and array_key_exists($thread_parent, $this->forum_post_mapping)) { $post_type_id = bbp_get_reply_post_type(); $thread_parent_id = (int) $this->forum_post_mapping[$thread_parent]; } else { + $thread_parent = 0; // Reply attached to a nonexistent parent are promoted to topic. $post_type_id = bbp_get_topic_post_type(); $thread_parent_id = $this->forum_mapping[$thread_forum_id]; }