Forráskód Böngészése

Fixing WP comments import

svalavuo 4 napja
szülő
commit
1bb41e8fb9
1 módosított fájl, 16 hozzáadás és 15 törlés
  1. 16 15
      includes/wordpress_import.php

+ 16 - 15
includes/wordpress_import.php

@@ -502,21 +502,22 @@ class WordPressImport {
                     
                     // Insert comment
                     $this->log("Executing INSERT for comment: '{$wpComment['comment_content']}' (Post ID: {$wpPostId})");
-                    $this->targetDb->query(
-                        "INSERT INTO comments (publication_id, parent_id, name, email, content, status, created_at, admin_reply, wp_comment_id) 
-                         VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
-                        [
-                            $publicationId,
-                            $parentId,
-                            $wpComment['comment_author'],
-                            $wpComment['comment_author_email'],
-                            $wpComment['comment_content'],
-                            $status,
-                            $wpComment['comment_date'],
-                            false,
-                            $wpComment['comment_ID']
-                        ]
-                    );
+                    $pdo = $this->targetDb->getConnection();
+                    $commentStmt = $pdo->prepare("
+                        INSERT INTO comments (publication_id, parent_id, name, email, content, status, created_at, admin_reply, wp_comment_id) 
+                         VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
+                    ");
+                    $commentStmt->execute([
+                        $publicationId,
+                        $parentId,
+                        $wpComment['comment_author'],
+                        $wpComment['comment_author_email'],
+                        $wpComment['comment_content'],
+                        $status,
+                        $wpComment['comment_date'],
+                        0, // Use integer 0 for admin_reply instead of boolean false
+                        $wpComment['comment_ID']
+                    ]);
                     
                     $commentId = $this->targetDb->getConnection()->lastInsertId();