Importing Mingle Forums into bbPress?
-
Is it even possible? I have a Mingle Forums install, but I want to switch to something like bbPress because Mingle development has stalled some year plus ago. I’ve got security worries and compatibility issues mounting, and want to switch to something better.
But I would MUCH rather not have to lose everything from my present forums. Am I fresh out of luck?
-
bbPress 2.1 includes a conversion tool to import forums/topics/replies/users from some of the popular forum packages eg. bbPress or phpBB
There is an ‘example’ file also included as a ‘reference template’ that if Mingle is using a SQL database then you could easily modify this to be a custom importer by matching the correct database tables/fields etc
The file is called ‘example.php’ and is located in /wp-content/plugins/bbpress/bbp-admin/converters
If you look at converting Mingle it would be great if contributed this back to bbPress for other Mingle users https://bbpress.trac.wordpress.org/
I would like to try this but I am having some trouble figuring out how to edit the example.php. Are there any instructions for this besides the comments?
Here is the file for reference: http://pastebin.com/MgUCdDp5
Here is the database structure from within phpmyadmin:
` wp_forum_forums
id
name
parent_id
description
views
sort
wp_forum_groups
id
name
description
usergroups
sort
wp_forum_posts
id
text
parent_id
date
author_id
subject
views
wp_forum_reputation_posts
id
author_id
post_id
post_author_id
value
date
wp_forum_threads
id
parent_id
views
subject
date
status
starter
last_post
closed
mngl_id
wp_forum_usergroup2user
id
user_id
group
wp_forum_usergroups
id
name
description
leaders`If anyone can take a moment to help me get started here it would be very much appreciated. I’m happy to provide any other information that may be helpful, so please just ask.
Ahmmm… OK… A couple of things to get started with…
I created a new page under Import Forums called Custom Import where we can start documenting how to go about actually customizing this file.
I also created a ticket #2134 as an update for Example.php is really needed to help improve the inline docs and code formatting to line up with the current bbPress1.php, phpBB.php and SimplePress5.php converters for improved readability will also help things along.
Now onto doing this… If we keep the discussion about Mingle here and update the codex as we go with any relevant information, steps and whatever else we bump into hopefully we will end up with some docs for customizing the included example importer.
I have the first few bits on the codex now, so go check that out ๐
ps. Anyone anyone can edit the codex docs pages using your bbpress.org credentials.
Thank you for taking the time to put this together Stephen. I’ve read the codex a few times over but it’s still a bit over my head. Hopefully over the weekend I will have some more time to make sense of things, but I do appreciate the prompt and very helpful response ๐
Next in the Forum Section for the third database mapping โTitleโ in Example.php Line#30
`
‘from_tablename’ => ‘forum_forums’
‘from_fieldname’ => ‘name’
`I was not sure what matched with the fourth mapping for the ‘Forum Slug’ so I have commented that out for now assuming that there is just nothing to import.
For the fifth database mapping โDescriptionโ in Example.php Line#43
`
‘from_tablename’ => ‘forum_forums’
‘from_fieldname’ => ‘description’
`Sixth mapping for ‘Forum display order’ in Example.php Line#50
`
‘from_tablename’ => ‘forum_forums’
‘from_fieldname’ => ‘sort’
`I also commented out the ‘Forum date update’ in Example.php Lines #56-72 section as there don’t appear to be any corresponding field names.
That wraps up the database mapping for the ‘Forums Section’. Moving along to the ‘Topics Section’ the ‘from_tablename’ appears to be ‘forum_threads’.
The first mapping for the ‘Topic id’ in Example.php Line#76
`
‘from_tablename’ => ‘forum_threads’
‘from_fieldname’ => ‘id’,
`Mapping ‘Forum id’ in Example.php Line#82
`
‘from_tablename’ => ‘forum_threads’
‘from_fieldname’ => ‘parent_id’
`Mapping ‘Topic author’ in Example.php Line#89
`
‘from_tablename’ => ‘forum_threads’
‘from_fieldname’ => ‘starter’
`Mapping ‘Topic Title’ in Example.php Line#96
`
‘from_tablename’ => ‘forum_threads’
‘from_fieldname’ => ‘subject’
`Mapping for ‘Topic Slug’ in Example.php Line#102
`
‘from_tablename’ => ‘forum_threads’
‘from_fieldname’ => ‘subject’
`Mapping ‘Forum id’ (again?) in Example.php Line#109
`
‘from_tablename’ => ‘forum_threads’
‘from_fieldname’ => ‘id’
`For the Topic dates I only found two matching tables instead of four. One is called ‘date’ the other ‘last post’. I assume that bbpress just needs either the GMT time or another format. I confirmed that the format Mingle uses does appear to be GMT based on the database showing “2012-04-29 20:55:59” and checking this. Therefore, I am only editing ‘post_date_gmt’ and ‘post_modified_gmt’ and commenting out the other two as follows.
Mapping ‘post_date_gmt’ in Example.php line#123
`
‘from_tablename’ => ‘forum_threads’
‘from_fieldname’ => ‘date’
`Mapping ‘post_modified_gmt’ in Example.php line#133
`
‘from_tablename’ => ‘forum_threads’
‘from_fieldname’ => ‘last_post’
`That completes the ‘Threads’ section, next are the ‘Tags’ which Mingle does not appear to support.
- This section has been commented out entirely.
Next up the ‘Post’ Section appears to map to the ‘forums_posts’ table from Mingle. There are only two ID fields present (id and parent_id) but both have the same values. I was not sure whether it would be better to only import one of the bbpress ids (post,forum,topic) or all three, so I have done all three below.
Mapping ‘Post id’ in Example.php Line#156
`
‘from_tablename’ => ‘forum_posts’
‘from_fieldname’ => ‘id’
`Mapping ‘Forum id’ in Example.php Line#162
`
‘from_tablename’ => ‘forum_posts’
‘from_fieldname’ => ‘parent_id’
`Mapping ‘Topic id’ in Example.php Line#169
`
‘from_tablename’ => ‘forum_posts’
‘from_fieldname’ => ‘id’
`No match found for ‘Author IP’ in Example.php Line#176 – Commented out
Mapping ‘Post author’ in Example.php Line#182
`
‘from_tablename’ => ‘forum_posts’
‘from_fieldname’ => ‘author_id’
`Mapping ‘Topic Title’ in Example.php Line#189
`
‘from_tablename’ => ‘forum_posts’
‘from_fieldname’ => ‘subject’
`Mapping ‘Topic slug’ in Example.php Line#195
`
‘from_tablename’ => ‘forum_posts’
‘from_fieldname’ => ‘subject’
`Mapping ‘Post content’ in Example.php Line#202
`
‘from_tablename’ => ‘forum_posts’
‘from_fieldname’ => ‘text’
`Mapping ‘Topic id’ in Example.php Line#209
`
‘from_tablename’ => ‘forum_posts’
‘from_fieldname’ => ‘id’
`Mapping ‘Topic Dates’ for ‘post_date_gmt’ and ‘post_modified_gmt’ in Example.php Line#223 and #232 (commented out non-GMT imports)
`
‘from_tablename’ => ‘forum_posts’
‘from_fieldname’ => ‘date’
`This ends the ‘Post’ section. I did not make any modifications to the ‘User’ Section. Are changes here required to import normal WordPress users?
The ‘wp_forum_groups’, ‘wp_forum_usergroups’, ‘wp_forum_usergroup2user’ and ‘wp_forum_reputation_posts’ tables are all empty so those must have been for other plugins that I have integrated with Mingle Forums.
I don’t see any further changes to make here so if someone would be kind enough to review this for any mistakes before I give it it a try I will let everyone know how it goes. ๐
I created a new WordPress installation Version 3.5 and installed bbpress plugin Version 2.2.3. Uploaded the Mingle.php file to /bbpress/includes/admin/converters/ and then ran the Tools > Forums > Import Forums tool using the following settings:
Select Platform: Mingle
Database Server: Server IP
Database Port: 3306
Database Name: My database name confirmed with host.
Database User: Same as database name, also confirmed.
Database Password: Confirmed correct password.
Table Prefix: I tried two settings here with the same result (‘wp_’ and ‘wp_forums’)
Rows Limit: 100
Delay Time: 1
Convert Users: Yes (checked)
Start Over: No (unchecked)
Purge Previous Import: No (unchecked)The result is below:
`
Repair any missing information: Continue
Conversion Complete
No replies to convert
No tags to convert
No topics to convert
No forum parents to convert
No forums to convert
No passwords to clear
No users to convertStarting Conversion
`I checked after importing and nothing was imported successfully. Any ideas what would cause this? I feel like I have one of the basic import settings wrong (maybe the database table prefix) since nothing is being found at all here.
Can you upload a copy of your Mingle.php https://gist.github.com/ (or pastebin.com)
(Its much easier for me to look at the code directly)Thanks for taking a look!
Nice… An extremely good first shot at mapping the MySQL database tables…
I have updated the file with a few things and it should now work…
If your WordPress database uses the out of the box `wp_` table prefix then for the Mingle.php converter we will use `wp_forum_` as the table prefix on the import setting.
- The forum slug is the same process as you did for topics & replies
- A couple of `id` vs `parent_id`
- Dates, WordPress stores four dates for a post in the `wp_posts` table, ‘post_date’, ‘post_date_gmt’, ‘post_modified’ and ‘post_modified_gmt’.
- Forums – In this case forum creation dates do not exist, this will default to the current date
- Topics – We map ‘date’ to ‘post_date’ & ‘post_date_gmt’ and ‘last_post’ to ‘post_modified’ & ‘post_modified_gmt’
- Replies – We map ‘date’ to all four ‘post_date’, ‘post_date_gmt’, ‘post_modified’ & ‘post_modified_gmt’.
So as I said, nice first go at it ๐
You can view the changes inline I made here and download the full file from here.
Thank you Stephen you are my hero! It appears to have worked flawlessly for the forums, but the users were not included. Here is the error I see when trying the import including users:
`
WordPress database error: [Table ‘str1210409063589.wp_forum_user’ doesn’t exist]
SELECT convert(user.userid USING “utf8”) AS userid,convert(user.password USING “utf8”) AS password,convert(user.salt USING “utf8”) AS salt,convert(user.username USING “utf8”) AS username,convert(user.email USING “utf8”) AS email,convert(user.homepage USING “utf8”) AS homepage,convert(user.joindate USING “utf8”) AS joindate,convert(user.aim USING “utf8”) AS aim,convert(user.yahoo USING “utf8”) AS yahoo FROM wp_forum_user AS user LIMIT 0, 500
`
From what I can tell bbpress uses the same registered users as WordPress so I may be able to import those separately.On another note, if I import to an existing installation instead of a fresh one would the forums be duplicated or just skipped during the import, so only the topics and replies are added?
Ahhh… Yes, if you are importing to the existing install of WordPress that Mingle is using you do not need to import the users as the existing users will have the same mappings.
If you want to import to a separate WordPress install you will need to import the users.
That was the reason I originally had each field as `’forum_forums’` and I have switched all the fields back to this so now and you should use the table prefix `wp_` on the import settings. I also updated user mappings, I just copied them in from the bbPress1.php importer as this is in the same boat.
I also added some extra phpdoc’s to the code and cleaned up some whitespace and changed the code layout style to match the other importers.
You should be able to use the same links above to download and compare the revisions.
What’s next? What works and doesn’t work?
- Is the imported forum hierarchy and order correct?
- Sticky topics, eg ‘sticky’ and/or ‘global sticky’ topics?
- Open or closed topics?
- Does Mingle use BBCodes eg [b]blod[/b] and do we need to convert them from custom HTML to WordPress/bbPress friendly HTML? If so what BBCodes does Mingle use?
Are there any other forums, topics or replies behaviour that has not been imported?
Using the older version was successful, but the new file gives me this error when importing with or without the users box checked.
`
WordPress database error: [Table ‘str1210409063589.wp_forums’ doesn’t exist]
SELECT convert(forums.id USING “utf8”) AS id,convert(forums.parent_id USING “utf8”) AS parent_id,convert(forums.name USING “utf8”) AS name,convert(forums.description USING “utf8”) AS description,convert(forums.sort USING “utf8”) AS sort FROM wp_forums AS forums LIMIT 0, 100
`Before anything appeared on the site I ran a complete repair with all option checked. After this was done and the wp_users table was exported/imported through phpMyAdmin everything is showing up. Before the users were imported it still worked but all except the admin posts were Anonymous.
Working:
- All forums that contained posts are present
- Forum descriptions
- The timestamps
- User account links and info (Forum Role,Topics Started, Replies Created)
- Topic/Voice counts
- bbcode is working for text formatting
- Started By and Freshness authors
- HTML code was imported and is displaying correctly
Not working:
- Parent forums are missing (everything was imported under ‘Forum’)
- There is a blank post by the original author at the start of each topic causing false count
- Custom Smileys “
- Closed Topics are open again.
- Stick Topics are normal topics
Did you use `wp_` as the table prefix?
Yes for the newest file but for the import that worked I used the older file and wp_forum_
Ok… What is the table structure showing in phpMyAdmin?
This would be the old WP/Mingle site (these are based on the DB schema in your first post)- wp_commentmeta
- wp_comments
- wp_forum_forums
- wp_forum_groups
- wp_forum_posts
- wp_forum_threads
- wp_forum_usergroup2user
- wp_forum_usergroups
- wp_links
- wp_options
- wp_postmeta
- wp_posts
- wp_terms
- wp_term_relationships
- wp_term_taxonomy
- wp_usermeta
- wp_users
The WP site you are importing into
- wp_commentmeta
- wp_comments
- wp_links
- wp_options
- wp_postmeta
- wp_posts
- wp_terms
- wp_term_relationships
- wp_term_taxonomy
- wp_usermeta
- wp_users
PHPMyAdmin for the OLD site im importing from:
-
wp_forum_forums
wp_forum_groups
wp_forum_posts
wp_forum_reputation_posts
wp_forum_threads
wp_forum_usergroup2user
wp_forum_usergroupsI hope this is what you were asking, it was not clear to me exactly.
PHPMyAdmin for the NEW site im importing into:-
wp_bbp_converter_translator
wp_commentmeta
wp_comments
wp_links
wp_options
wp_postmeta
wp_posts
wp_terms
wp_term_relationships
wp_term_taxonomy
wp_usermeta
wp_usersIf you view the source of the importer browser window, the ‘yellow window’ panel you should see the SQL queries listed in the source…
There are 4 main queries and they should look like this:
- SELECT convert(forum_forums.id USING …
- SELECT convert(forum_threads.id USING …
- SELECT convert(forum_posts.id USING …
- SELECT convert(users.ID USING …
This matches the table structure I listed above and use `wp_` as the table prefix.
Yes, thats what I wanted…. Why do you not have any WordPress tables in your old site?
Specificity if your users are not stored in `wp_users` where are they stored?I do have them, I was just listing what was relevant to the Mingle Forums but here is the entire list which contains tables from activate and inactive plugins not related to the forums.
wp_blogs
wp_blog_versions
wp_commentmeta
wp_comments
wp_forum_forums
wp_forum_groups
wp_forum_posts
wp_forum_reputation_posts
wp_forum_threads
wp_forum_usergroup2user
wp_forum_usergroups
wp_links
wp_options
wp_postmeta
wp_posts
wp_site
wp_sitemeta
wp_terms
wp_term_relationships
wp_term_taxonomy
wp_usermeta
wp_users
(Edit: I just culled unneeded tables from the list, Netweb)Cool…. Everything should work…
With the two posts above of your errors.
Case 1. You used `wp_forum_` on that first revision when I used forum , threads, posts & user as the from_tablename’s, the error you posted was `’str1210409063589.wp_forum_user’` and that is correct as the importer was trying to find `wp_forum_user` which indeed does not exist.
Case 2. You used `wp_` on that second revision when I used forum_forums , forum_threads, forum_posts & users as the from_tablename’s, the error you posted was `’str1210409063589.wp_forums’` and that is not what I would expect to see here, it should be forum_forums.
Can you confirm by downloading the latest revision with this link and replacing Mingle.php with the version extracted from this zip file and use `wp_` as the table prefix.
https://gist.github.com/4534229/downloadI downloaded the new version and the import was successful under wp_ prefix but it seems the same issues remain as I listed above. Many of these are not a problem for me personally except for the blank first post issue which would be nice to correct.
So it imported users, forums, topics & replies? Nice ๐
There is a blank post by the original author at the start of each topic causing false count
Let me double check that I am not importing something twice…
Parent forums are missing (everything was imported under โForumโ)
Joining the `wp_forum_groups` will be a pain if there are ‘id’ conflicts, easy workaround is just manually create the parent category with bbPress.
Custom Smileys, Closed Topics are open again & Stick Topics are normal topics
These three are easy,
Smiley’s: I think these are done ๐
Closed Topics: Does the table `wp_forum_threads` have a specific column for the open/closed status of a topic? If so what are the potential values?
Sticky Topics: Does the table `wp_forum_threads` have a specific column for the sticky status of a topic? If so what are the potential values?
(For the closed and sticky table options, sometimes its numerical 0,1,2 or it might have a value normal or sticky or closed etc)
‘wp_forum_threads’ has a ‘closed’ column where 0 is open and 1 is closed.
‘wp_forum_threads’ has a ‘status’ column with values of ‘sticky’ or ‘open’.
I have no problems re-creating the parent forums personally, I just wanted to make sure we had the correct setting as I am sure there will be others who try to use this.
Everything has really gone so much better than I hoped for so I could not be happier with the outcome. Thanks again for all of your help with this!
Smileys & Open/Closed Topics are done, stickies we can’t do for now and that will have to wait.
Grab the latest again with https://gist.github.com/4534229/download
I’m still not sure why the extra blank post is turning up ๐
- You must be logged in to reply to this topic.