Skip to:
Content
Pages
Categories
Search
Top
Bottom

Importer major issue


  • auberlu
    Participant

    @auberlu

    Hello,
    I’d like to share my workaround to fix the following problem:
    After importing all topics and posts and forums and users from my old WebsiteA, I couldn’t see any topics inside my forums on my new WebsiteB. The counts were correct, but I could only see sticky topics inside each forum, nothing else.

    I tried the built-in fixing tools, but that was a BAD IDEA. It broke my site every time I tried it (blank page on front-end without any error). The only way to fix it was to restaure the whole database!

    So I looked at the database and found that a simple info was missing. All topics were set with post_parent = 0, while the corresponding postmeta _bbp_forum_id field was set correctly.
    All that was needed to do is to update this post_parent field by fetching this meta value.
    Here’s my working SQL script (of course do NOT FORGET to save your database first…):

    UPDATE 'wp_posts' 
    SET post_parent = (
    SELECT meta_value 
    FROM 'wp_postmeta' 
    WHERE post_id=ID AND meta_key="_bbp_forum_id") 
    WHERE post_parent = 0;

    I also want to point something VERY annoying when using the WP importer. WordPress asked me to match every single forum user from WebsiteA with the dropdown list of users from WebsiteB, which is very stupid since I had imported all the users. They were all identical.
    It literally took me an hour to select every user on the dropdown menu…
    The user IDs were the same on both websites!! Why not auto-selecting???????

    I hope some dev will see this and fix it somehow, because it sounds like something quite easy to fix 😉
    Have a nice day

Viewing 2 replies - 1 through 2 (of 2 total)

  • auberlu
    Participant

    @auberlu

    I forgot to mention the other SQL script required to fix the import.
    Only the first post of each topic was displayed. A quick glance at the database and I saw that post_parent of each reply was set on the forum and not the topic.
    So here we go :

    UPDATE wp_posts m1 
    LEFT JOIN wp_postmeta m2 ON m1.ID = m2.post_id AND meta_key = '_bbp_topic_id'
    LEFT JOIN wp_posts m3 ON m1.post_parent = m3.ID AND m3.post_type != 'forum'
    SET m1.post_parent = m2.meta_key
    WHERE m1.post_type = 'reply' AND m1.post_parent != m2.meta_value

    auberlu
    Participant

    @auberlu

    I forgot to mention the other SQL script required to fix the import.
    Only the first post of each topic was displayed. A quick glance at the database and I saw that post_parent of each reply was set on the forum and not the topic.
    So here we go :

    UPDATE wp_posts m1 
    LEFT JOIN wp_postmeta m2 ON m1.ID = m2.post_id AND meta_key = '_bbp_topic_id'
    LEFT JOIN wp_posts m3 ON m1.post_parent = m3.ID AND m3.post_type != 'forum'
    SET m1.post_parent = m2.meta_key
    WHERE m1.post_type = 'reply' AND m1.post_parent != m2.meta_value
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar