[ Web Proxy ]
URL:
Viewing: https://bbpress.org/forums/topic/import-single-post-and-its-comments/ [Back]  [Original]

Topic: Import single post and its comments · bbPress.org
Skip to:
Content
Pages
Categories
Search
Top
Bottom

Import single post and its comments

  • Hi, I have a somewhat unusual question. On my site, I have a specific post with 78 comments. Now that Ive set up bbPress, Id like to move the entire discussionincluding the post and all commentsinto a forum as a topic with replies.

    I havent found a ready-made way to do this. Using WP-CLI, I exported all 78 comments to a CSV file in the following format:

    “author_id”,”date_time”,”comment_text”

    I then tried creating a shell script that uses tail on the file, processes it with sed and cut to separate the columns, and then loops through an import with wp cli post create using post_type=reply and post_parent set to the main post (which I can easily create manually).

    But with my very basic knowledge, I havent been able to get it to work, so Im giving up trying on my own.

    I only want to do this operation for this specific post, and maybe one more with 12 comments. It would be wonderful to have it moved as a topic in the bbPress forum.

    Does anyone happen to have a ready solution, or a bit of time to help me out?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Ok, I am just a volunteer who helps out here, I am not a bbpress author, but I have written a number of bbpress related plugins.

    I also took over a defunct plugin called

    Post Comments as bbPress Topics

    I did not write this, I just did enough coding to get it working again.

    if you are code savvy, then function build_topic on line 485 of index.php should give you some code that you could maybe use in a plugin or use the code snippets plugin.

    otherwise if you only have a few posts from which you want 2, you could enable it convert, disable it and then delete the topics (posts) you don’t want.

    Thanks, Robin much appreciated.

    Unfortunately, no, Im not comfortable with code, and definitely not at that level.

    With the plugin youre suggesting: am I correct in understanding that it does not import existing comments from the original post as replies in bbPress? What I would really like is to move all 78 comments over as replies in the bbPress topic, and ideally be able to delete the original post entirely afterwards.

    Ive already created the topic itself manually in the correct forum, preserving the original text, date, and author. The only remaining (small ) problem is the replies. And since those 78 comments contain a lot of valuable content, it wouldnt feel right to start over from scratch in the forum.

    ok if you can wait a day or 2, then I’ll write a small plugin that will do that, most of the code already exists.

    Thanks, Robin that would be absolutely fantastic!

    With a smooth and simple solution like that, I could even consider importing 34 more posts that originally were discussion posts and would fit much better in the forum. But no larger volumes than that.

    I dont know exactly how youre planning to solve it, but if possible, it would be great to keep the original post and its comments intact until everything is confirmed to be working. If its easier to convert the existing content directly, thats perfectly fine as well.

    In our system, users also have the option to delete their own accounts if they wish. I assume we therefore need to take into account that some users who commented may no longer have a valid user ID. In that case, I guess a fallback user is needed? I do have such a user in my system called Deleted User, whose user ID could be used if necessary.

    Im also not entirely sure how bbPress handles topics and replies when the original user accounts are deleted I havent had a chance to test that yet.

    Many thanks for your help. I really dont have the required level of knowledge for this, so its very much appreciated.

    quick response, I’m a UK farmer, so out a lot of the daytime !

    As a ‘quick and dirty’ solution you would need to create the topic

    Then in a new item I’ll add in the dashboard enter the post ID and the Topic ID

    This will then create a new reply.

    It will keep the existing comments.

    from memory bbpress uses ‘anonymous’ for any user that no longer exists, but if you create a ‘deleted user’ I might be able to add that to the code

    Topics already created with correct text, date and author so that’s fine.

    Anonymous as name for users that no longer exists is perfectly fine.

    So if I understand correctly, I would need to provide the ID of the original post and the ID of the new topic in the forum, and your plugin will clone each individual comment into a reply in the topic with the correct author and date? That sounds absolutely fantastic!

    yep – that is what I am planning – be back when I’ve done it

    Plugin created – go to

    Create replies from post comments

    and follow the instructions

    any issues let me know

    Hi Robin. Ive now run the plugin with great success no issues at all. Im currently double-checking everything to make sure nothing went wrong, but so far it looks perfect.

    So my warmest thanks! I would never have managed to solve this on my own, despite my best attempts.

    Great, glad to have helped

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Skip to toolbar

Web Proxy Viewer  |  New URL  |  Original Page