renzopalacios (@renzopalacios)

Forum Replies Created

Viewing 1 replies (of 1 total)

  • renzopalacios
    Participant

    @renzopalacios

    It’s been almost 2 years, but I wanted to post my reply anyway because I think it can help someone.

    Following @mikecostanzo insights, I built these SQL queries which repopulates the missing post_parent values successfully. Doing this a forum is reconnected with its topics, and topics are reconnected with its replies.

    Remember that first, you need to import the forum, topics, and replies using WordPress importer. These actions import as well the involved users.

    I applied this solution for a single forum but it can be used as a starting point modifying some parameters if required:

    For topics:
    UPDATE
    wpmd_posts
    INNER JOIN (wpmd_postmeta) ON (wpmd_posts.ID = wpmd_postmeta.post_id AND wpmd_postmeta.meta_key = ‘_bbp_forum_id’)
    SET
    wpmd_posts.post_parent = wpmd_postmeta.meta_value
    WHERE
    wpmd_posts.post_type LIKE ‘topic’

    For Replies:

    UPDATE
    wpmd_posts
    INNER JOIN (wpmd_postmeta) ON (wpmd_posts.ID = wpmd_postmeta.post_id AND wpmd_postmeta.meta_key = ‘_bbp_topic_id’)
    SET
    wpmd_posts.post_parent = wpmd_postmeta.meta_value
    WHERE
    wpmd_posts.post_type LIKE ‘reply’

Viewing 1 replies (of 1 total)