Skip to:
Content
Pages
Categories
Search
Top
Bottom

Import BB data from CSV file to bbPress forum


  • harpeml
    Participant

    @harpeml

    Hello,

    I am new to the WordPress world and setting up my first experimental site inside my company. I want to move a blog/forum from an old home grown system to a new bbPress forum. I do not need to carry over replies; just the topics, write ups, author, and tags. I have all of the information in a spreadsheet. Assuming all of the old authors have accounts in the new WordPress, is there a way to import the topics and their metadata? I see importers for some specific BBs but nothing for just a generic data file.

    Thanks much for any suggestions,
    Mike Harper

Viewing 25 replies - 1 through 25 (of 33 total)
  • I hadn’t really thought about importing from CSV, until now.

    The importer included with bbPress is setup to only import from a MySQL database.

    We could create a guide to create a simple to database that you could import your CSV into and then bbPress import from that.

    Otherwise using the built in importer within WordPress (wp-admin -> tools -> import /wp-admin/import.php) there are some https://wordpress.org/plugins/search.php?q=CSV+importer CSV importers that might do the job. You could modify one of these to import the data instead of WordPress post type ‘post’ you would want your topics to use the ‘topic’ post type for bbPress (Forums are ‘forum’ and Replies are ‘reply’)

    Either of the ways above should be rather straight forward and I might take a look at few of those importers and fork one specifically for importing from CSV to bbPress in the future.


    sciman@cpp.edu
    Participant

    @scimancsupomonaedu

    I would sure support this. I’m a newbie to WP and would like to use bbPress, but have a lot of old hypercard forum posts I’ve reduced to a Filemaker database. I have about 7 named forums, have authors and their post in date order. None need to be linked as replies. There’s tremendously valuable information on family histories in this archive that I’d dearly like to remain available for those interested. If I could get these posts to a forum, that would be extremely helpful.

    I’d highly suggest you take a look at some of these CSV importers that support ‘Custom Post Types’, I have had a quick look at a couple of them the other day and I am quite sure they will work fine to import into bbPress.

    It is just a matter of finding the one that suits you and your CSV data.


    harpeml
    Participant

    @harpeml

    Thank you for all the guidance Stephen. I appreciate the help.

    Cool 🙂 Once you have tried them let me which one worked for you. If none work we will then look at forking one of them and writing a custom version for bbPress. If that doesn’t work we can come up with a custom CSV format to import directly into MySQL and then write an extension for the bbPress importer. In the end there will be a way. 🙂


    sciman@cpp.edu
    Participant

    @scimancsupomonaedu

    This is terrific, though I suppose that I have to learn somehow the field names to be mapping my fields to. I’ve not actually installed the bbPress plug-in as yet. Does it work with the regular WP database, so that I import the ‘custom post type’ to a WP install, or does it get imported to bbPress itself. Boy am I dumb;-) But thanks Stephen — your responsiveness if super encouraging.


    harpeml
    Participant

    @harpeml

    Hi Again, I looked at the plug-ins and it seemed that WP Ultimate CSV Importer would do the job. I tried importing one of their example CSV files. It lets me choose the post type “forum” although I see no way to provide a forum title. It appeared to work with no errors. However, looks like it took each post entry and created a new Forum with it. I see no way to have the posts come in as topics under an existing or new Forum. Is there a way to change this once the import is done?

    Sorry I am not a PHP person and not familiar with the inner workings of WordPress.

    Firstly, thanks for looking further into this, it gave me enough info to run a quick test import.

    bbPress uses WordPress tables and doesn’t create any of its own and not having answers to something you don’t know doesn’t make anyone dumb. 😉

    Ok…. Here we go….

    I installed this plugin https://wordpress.org/plugins/wp-ultimate-csv-importer/

    I realised the csv file had to be split into 3, one for the forum, one for topics and one for replies. Here is a copy of the 3 CSV files I used https://gist.github.com/ntwb/6532360

    Next jump into WP Admin and and open up the WP CSV Tool and select ‘Custom Post’ to import from and select your forum.csv file to upload and click import.

    Set the options and field mappings as per this:

    Import Data Configuration

    Select Post Type = forum
    Import with post status = publish
    post_author = post_author
    post_date = post_date
    post_content = post_content
    post_title = post_title

    And click import.

    Topics is up next and you will notice that it includes the field ‘post_parent’ so this is the forum ID that the topic will be imported into. As we do not know the forum ID you will need to open up the bbPress forums panel in wp-admin. Select the forum you want the topics to be imported and this will take you into the forum edit section, look at the URL in your browser and it should be similar to /wp-admin/post.php?post=348830&action=edit what we want here is the ‘348830’ as that will be the parent forum for each topic imported. Update your topic.csv file with this number as per my sample linked above.

    Back to the CSV importer to import your topics.csv

    Set the options and field mappings as per this:

    Import Data Configuration

    Select Post Type = topic
    Import with post status = publish
    post_author = post_author
    post_date = post_date
    post_content = post_content
    post_title = post_title
    post_parent = post_parent

    The replies section is basically the same as the topics section, you need to get the ID orf each topic ID for each reply and update your reply.csv file for each entry.

    Lastly run each of the ‘Recalculate’ and ‘Count’ bbPress ‘Repair Tools’ from wp-admin-> Tools- Forums -> Repair Forums (more info here https://codex.bbpress.org/repair-forums/)

    And I think that’s it, there is a bit of juggling your data around, give it a bash and let me know how it works out for you and here’s the result 🙂


    sciman@cpp.edu
    Participant

    @scimancsupomonaedu

    Thanks so very very much, Stephen. I hope that others in the future can find this very helpful guidance for custom importing since it’s so much clearer than the advice I’d seen elsewhere. I will give it a go and post any observations I may have from the experience.


    sciman@cpp.edu
    Participant

    @scimancsupomonaedu

    One other question, Stephen. As I think through this, don’t I also somehow need to be concerned about getting my authors and perhaps their email addresses registered as members of the site or something? I’d imagine that that would need to be done first. Interestingly, as I look at the file data I have, the identified “author” sometimes has taken new names, and of course email addresses probably require updating. Do I need to assign passwords or something? I hope not, though I expect this depends on how I will choose to configure or reconfigure permissions for posting at the website? Again, thanks a million for any help.

    Ahhh… Yes… That would make sense, probably a dedicated ‘User CSV Import’ plugin eg. https://wordpress.org/plugins/search.php?q=csv+user plugin that matches your requirements.

    You shouldn’t have to assign passwords, users can do this themselves later.

    Once you have your users you will want to update your topic.csv & reply.csv files with the new user ID’s.


    harpeml
    Participant

    @harpeml

    Hello Stephen,

    I have a follow up question on the above topic. In the old BB we had each topic showed with a short summary field of the post content (usually just the first X characters of the content). Is there a way to do that with bbPress Forum topics? I do not see any existing widget that does this. In fact, is there even a field mapping for such a thing?

    thanks,
    Mike


    harpeml
    Participant

    @harpeml

    Oops, forgot another item. I want to bring in topic tags as well. How do I do that.

    thanks


    harpeml
    Participant

    @harpeml

    For example, when I go to the support forums for bbPress I see a widget on the left that lists links for tags that have appeared in the forums/posts. How would get that?

    Sorry about the multiple messages.

    I have a follow up question on the above topic. In the old BB we had each topic showed with a short summary field of the post content (usually just the first X characters of the content). Is there a way to do that with bbPress Forum topics? I do not see any existing widget that does this. In fact, is there even a field mapping for such a thing?

    In WordPress terms this is known as ‘the_excerpt’ and is a function that will only show ‘x’ words of a post, this is not something you can transfer, it is a ‘display’ function in WordPress.

    Oops, forgot another item. I want to bring in topic tags as well. How do I do that.

    These are a little tricky mainly because understanding how they are implemented in WordPress is not an easy task as they are distributed throughout three tables.

    Upload a csv file to http://gist.github.com or http://pastebin.com with a couple of examples of how your data currently has ‘tags’ associated to the topics and I will try to come up with something that is a little clearer than mud for you 😉


    harpeml
    Participant

    @harpeml

    Hi, the import went reasonably well for me. Thanks for all the guidance.

    I imported values for the “excerpt” field for each topic under a forum post. They do not seem to show up yet in the forum view. What can I do to have them display along with the topic titles in the view listing?

    Thanks

    You won’t need this text and/or value that you imported.

    You will have to create your own templates by copying bbPress templates to your theme directory:

    https://codex.bbpress.org/theme-compatibility/

    You would then use the_excerpt rather than the_content to output only ‘x’ words from each topic/reply

    https://codex.wordpress.org/Function_Reference/the_excerpt

    There are a few people who have played around using the_excerpt and bbPress, have a good look around the site to see how and what they did:

    https://bbpress.org/forums/search/the_excerpt/


    dmx09
    Participant

    @dmx09

    Sorry to hijack this thread @harpeml but this might just be what I’m looking for.


    @netweb
    – We are in the process of migrating a Ning site to a bbPress forum. We managed to import some of the content using the ‘Import from Ning’ plugin but unfortunately it didn’t import any replies (just the main topics were imported).

    From what I can see, it might be possible to convert the json file (which is exported from Ning) to a CSV file and then import that in the way you have suggested above. Do you think this would work?

    It appears Ning don’t make it particularly easy to get content to other platforms!
    Any guidance most appreciated.

    Indeed this would work converting the JSON to a CSV but I’d suggest another route first if you haven’t tried it. There is a long discussion on the Ning Importer support forum here that should help you get the Ning importer “working” (read some of the other replies before and after the one I linked for more context).


    dmx09
    Participant

    @dmx09

    Many thanks @netweb, I’ll give it a go and let you know how we get on. Appreciate your guidance on this. 😉


    dmx09
    Participant

    @dmx09

    HI @netweb. Regarding importing ‘Replies’ and matching up the ID of their respective Topics, should I add the ID’s into the last field of the csv, ie; where ‘post_parent’ is located below? So ‘348830 is the ID of the parent topic…

    post_author,post_date,post_content,post_title,post_parent
    1,2010-09-01 00:37:17,1st topic content,1st Topic,348830


    dmx09
    Participant

    @dmx09

    ooh, also… Am I getting this wrong but I’m not sure ‘Replies’ have post titles?


    dmx09
    Participant

    @dmx09

    Sorry, I’d edit my last post but I can’t see a way of doing that!

    Just an update on progress… So far I’ve managed to import a test batch of topics and they are all in the right place in the admin, however – when I view their parent forum on the front end they are not displaying.

    Topics I’ve created via the admin (Topics / Add New) seem to work fine but none of the imported Topics will display. I’ve even compared the tables in the DB but cant spot anything wrong there.

    Any thoughts welcome!

    Apologies for the late reply, importing alone will not add all the required “meta data” that bbPress requires, after importing your batch of test topics go to “Tools -> Forums” and run each of the bbPress repair tools, this should fix your issues of not seeing the topics on the front end.


    dmx09
    Participant

    @dmx09

    We managed to get the content imported (most of it anyway) using the thread you mentioned, thanks for that @netweb.

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