This is how to export data from BBPress, which would be useful if you wanted to migrate from BBPress to another forum platform.
Its straight SQL export direct from the mysql database, with things like forum posts (topics ) and forum replies, as well as some other data including users ( and their user ids etc ).
I’ve exported the forum data into a table, then escaped the quote marks and finally output into a csv (comma separated list ) file that can be used to suck into the relevant system , where you’re moving the BBPress forum to.
# get the data into a temporary table drop table export_for_new_site; CREATE TABLE export_for_new_site SELECT forum.post_title AS forum, p.id AS topic_post_id, p.post_title AS topic, p.post_date as topic_date, p.post_content AS topic_content, topic_poster.ID AS poster_user_id, topic_poster.user_email AS poster_email, topic_poster.display_name AS poster_name, topic_poster.user_login AS poster_user_login, topic_poster.user_nicename AS poster_user_nicename, topic_poster.user_registered AS poster_user_registered, replies.id AS reply_post_id, replies.post_content AS reply, replies.post_date, replier_name.display_name AS repliter_name, replier_name.ID AS replier_user_id, replier_name.user_email AS replier_email, replier_name.user_login AS replier_user_login, replier_name.user_nicename AS replier_user_nicename, replier_name.user_registered AS replier_user_registered, p.ID, p.post_type FROM wp_posts p INNER JOIN wp_postmeta ON(p.ID = wp_postmeta.post_id) LEFT JOIN wp_posts replies ON ( p.ID = replies.post_parent AND replies.post_type = 'reply' AND replies.post_status = 'publish' ) LEFT JOIN wp_posts forum ON ( p.post_parent = forum.ID AND forum.post_type = 'forum' ) LEFT JOIN wp_users topic_poster ON ( p.post_author = topic_poster.ID ) LEFT JOIN wp_users replier_name ON ( replies.post_author = replier_name.ID ) LEFT JOIN wp_posts topic_file ON ( p.ID = topic_file.post_parent AND topic_file.post_type = 'attachment' AND topic_file.post_status = 'inherit' ) LEFT JOIN wp_posts reply_file ON ( replies.ID = reply_file.post_parent AND reply_file.post_type = 'attachment' AND reply_file.post_status = 'inherit' ) WHERE 1 = 1 AND( wp_postmeta.meta_key = '_bbp_last_active_time' ) AND p.post_type = 'topic' AND(p.post_status = 'publish') ORDER BY forum.id DESC; # escape double quotes ( so when csv export = good ) UPDATE export_for_new_site SET topic_content = REPLACE( topic_content ,'"','""'); UPDATE export_for_new_site SET reply = REPLACE( reply ,'"','""'); # generate the csv SELECT * from export_for_new_site INTO OUTFILE 'YOUR PATH HERE/forum_stuff2.csv' FIELDS TERMINATED BY ',' ESCAPED BY '' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'
Is it possible to use some of this SQL to actually save to a sql-file, so it can be used to dump the forum from the old site, and run the SQL to migrate this into a fresh wordpress / bbpress-install?
I am looking for a way to create 3 different sqls:
1. Forums
2. Topics
3. Replies
And then just run those sqls on the fresh install.