Skip to:
Content
Pages
Categories
Search
Top
Bottom

WP Symposium converter for bbPress


  • lagrou
    Participant

    @lagrou

    I have a forum running WP Symposium and WordPress, all current versions, that I want to convert to bbPress. Won’t elaborate on reasons unless deemed to do so, LOL.

    I have first started with a converter of my own, which was creating custom post types for forums, topics, and replies. Unfortunately, counters in bbPress weren’t set, so the frontend pages were incorrect, replies were not chained one after the other in topics, etc.

    While digging these issues, I found out that bbPress has its own converter that works using modules. So I started over by creating a module, based on the existnig ones and URLs given in this forum, and tried to make it work for forums, first. But, they simply won’t convert, whatever I try I get ‘no forums to convert’.

    While I have a relatively good knowledge of WP Symposium database tables, via custom developments etc., I’m at a loss on bbPress side. Hopefully someone can catch my call so we work together on adding WPS to the list of importable plateforms for bbPress…?

    Thanks a lot,
    Antoine

Viewing 21 replies - 1 through 21 (of 21 total)

  • lagrou
    Participant

    @lagrou

    I’ve created a Github account so I can share my code so far.
    https://github.com/Lagrou/wps_extends_bbp_converter

    First issue (question) is, why the converter doesn’t find forums. Or at least doesn’t convert them.

    Second, WP Symposium stores topics and replies in the same table, and they belong to a category stored in another table. How do I mimick, using the converter, the selection of topics of a given category:

    $sql = "SELECT * FROM ".$wpdb->prefix."symposium_topics WHERE topic_parent = 0 AND topic_category = %d";
    $wps_topics = $wpdb->get_results( $wpdb->prepare( $sql, $cid ), ARRAY_A );

    Where $cid is the category/subforum id.

    Third and likewise, topics don’t have parents, while replies (obviously) do. So how to get, for a given topics, the list of replies WHERE topic_parent = %d.

    And fourth, WP Symposium does not store the number of topics / replies. How do I get count($wps_topics)

    Thanks…

    Awesome… It is late here and I will take a closer look in the morning šŸ™‚

    Any chance you could post an example database scheme layout (even better a MySQL export)

    It would only need to have a couple of categories, couple of forums, couple of topics, couple of replies, a couple of topic categories, a couple of xyz etc?

    I can read the database schema so much easier than trying to have a conversation trying to explain the DB schema šŸ˜‰

    That said a couple of quick points, we can join tables together or join the same table to filter topics from replies and replies from topics.

    Most likely your ‘forums’ section isn’t quite right, again this will be an issue of just mapping the correct fields to the source database schema, likewise for topic parents, they will have one in the database schema somewhere.

    Counts also do not matter, they help but are not essential, we have built in tools to recount this when needed.

    I’m more than happy to take a look with you and add this to the growing collection of bbPress importers šŸ™‚


    lagrou
    Participant

    @lagrou

    I’ve added a WPS install to one of my test sites. By default WPS has 3 forum categories, and one topic with two replies. I’ve added two topics, to populate all categories, and made one category child of another. So it should look like what you expect.

    I’ve also created a group. In WPS, groups can have a forum, with no category hierarchy, so they are not listed in the table symposium_cats. I wasn’t using groups myself, but my proposal is, if we can, to make the converter gather the content as a subforum in bbPress, then the admin may decide to delete or restrict its content ? So, I’ve also created a group on that test install, with a topic and a reply.

    As I’m not sure what you call a MySQL export I’ve dumped it using a page template where I perform a succession of queries, then var_dump( $wpdb->last_query, $result ); and copy/pasted the page content as a text file, added to my repository above. I hope it’ll be fine.

    Turns out when I said it was late, it was, I downloaded and installed the plugin šŸ˜‰

    Firstly for most forum importers I use a set of categories and forums based on the ‘Nested Set Model’, this gives a great hierarchy layout to test with.
    https://en.wikipedia.org/wiki/Nested_set_model#Example

    First issue (question) is, why the converter doesnā€™t find forums. Or at least doesnā€™t convert them.

    For the ‘Forum slug’ you have slug it should be stub

    Does WPS ‘pretty permalinks’ even work? I am guessing that’s what these are?

    Once I changed that the forums imported fine with correct title, desc, parent, order, slug.

    We don’t need to worry about counts as the bbPress repair tools will do this for us

    Categories or Forums I am not sure of, to set a category in WPS I set the Allow new topics? field to no we can use this to decide if the bbPress forum will be a forum or category if this is indeed the intended purpose of this field.

    Cloudup nea52czefrz

    I’ll go take a look at the topics and replies now…

    Created a pull request https://github.com/Lagrou/wps_extends_bbp_converter/pull/1 šŸ™‚

    WPSymposium – 1st pass update ā€¦
    * Cleans up PHPDoc for WPSymposium Converter
    * Fixes Forum slug field mapping
    * Add Topics section
    * Adds Reply Section
    * Adds callback_topic_status for open or closed topics
    * Adds callback_sticky_status for sticky topics
    * Adds reserved callback callback_forum_type to be implemented
    * Adds reserved callback callback_forum_status to be implemented

    Per my previous comment we should be able to determine forum type and forum status.

    I haven’t added a users section yet, need to think about this a little, there are two use cases, if you add bbPress to same WordPress install as you have used for WPS vs importing into a fresh WordPress install where WPS has never existed.

    For reference the core SQL queries: (Don’t forget the table prefix e.g. wp_)

    Forums:

    
    SELECT 
    symposium_cats.cid AS cid,
    symposium_cats.cat_parent AS cat_parent,
    symposium_cats.title AS title,
    symposium_cats.stub AS stub,
    symposium_cats.cat_desc AS cat_desc,
    symposium_cats.listorder AS listorder 
    FROM wp_symposium_cats AS symposium_cats
    

    Topics

    
    SELECT 
    symposium_topics.tid AS tid,
    symposium_topics.topic_category AS topic_category,
    symposium_topics.topic_owner AS topic_owner,
    symposium_topics.topic_post AS topic_post,
    symposium_topics.topic_subject AS topic_subject,
    symposium_topics.stub AS stub,
    symposium_topics.allow_replies AS allow_replies,
    symposium_topics.topic_sticky AS topic_sticky,
    symposium_topics.topic_started AS topic_started,
    symposium_topics.topic_date AS topic_date 
    FROM wp_symposium_topics AS symposium_topics 
    WHERE symposium_topics.topic_parent = 0
    

    Replies

    
    SELECT 
    symposium_topics.tid AS tid,
    symposium_topics.topic_category AS topic_category,
    symposium_topics.topic_parent AS topic_parent,
    symposium_topics.topic_owner AS topic_owner,
    symposium_topics.topic_post AS topic_post,
    symposium_topics.topic_started AS topic_started 
    FROM wp_symposium_topics AS symposium_topics 
    WHERE symposium_topics.topic_parent != 0 
    

    lagrou
    Participant

    @lagrou

    Sorry my dump wasn’t successful in helping you out here…

    Slug vs. stub, I missed that one, I tried your version on my test install and it works !! It converted forum / topics / replies. Thanks! Couple of issues, questions, comments…

    In WPS terminology, there’s one forum made of categories. They can be nested. Along with subforums, they may contain topics with replies. One of these cats may be made the “default category” which users will be prompted with when posting in the forum frontpage, that’s ‘symposium_cats.defaultcat’. If not set, the first of the list will be the default. I’m not sure what happens if two or more cats are made default…

    ‘Allow new topics’ will basically close the category to new topics. Likewise, in a topic there’s a checkbox to allow new replies or close the topic.

    ‘remote_addr’ is for monitoring spammers, I don’t think it deserves much interest in importing forum content as it’s mainly a short-time asset.

    I’ll go through your callback functions tomorrow, but a quick comment about values in WPS: they are either ‘on’ or anything else, possibly not set, so it’s better to revert the switch and test against the “case ‘on'” and any other “default” ?

    The group forum post from my demo install was converted. In the list of topics it is indicated as ‘no forum’ which is true (as per my previous post). We should either create a forum (named like the group itself for instance) or discard group forums topics altogether (WHERE symposium_topics.topic_group != 0).

    About importing users, you raise an interesting point. I’d like to understand if this tool is a converter or an importer. Being located in a folder called /converter/ I had assumed it should work within the same WordPress install and convert it from one plugin to another, but you seem to move it towards the import of data accross platforms. Incidentally, I have been wondering why I need to fill the ‘Database Settings’ with db name / user / password / prefix, while I’m converting an existing forum within the same base. I’m happy with both, although I would tend to consider that most WP-to-WP imports will be performed within the same site…?

    The other topics I’d like to bring at some point in our discussion are the attachments and the avatars. I’m not sure yet how bbPress handles attachments, for WPS they are physically stored in a location set from the “params” tab, and displayed either online or as links (depending on a setting). As far as avatars, once WPS is deactivated they are all gone, is anything possible or is this too dependent upon the plugin the admin may install for avatars ?

    Sorry my dump wasnā€™t successful in helping you out hereā€¦

    Your dump was fine, it was just for quicker for me to install the plugin and have the examples included, if I wasn’t so tired the other night I would have done that in the first place and not asked. šŸ˜‰

    Slug vs. stub, I missed that one, I tried your version on my test install and it works !! It converted forum / topics / replies. Thanks! Couple of issues, questions, commentsā€¦

    Awesome

    In WPS terminology, thereā€™s one forum made of categories. They can be nested. Along with subforums, they may contain topics with replies. One of these cats may be made the ā€œdefault categoryā€ which users will be prompted with when posting in the forum frontpage, thatā€™s ā€˜symposium_cats.defaultcatā€™. If not set, the first of the list will be the default. Iā€™m not sure what happens if two or more cats are made defaultā€¦

    Cool, for example per this picture is what you are saying if I understand correctly is that I could choose the ‘Sun Dreesses’ forum to be the default forum selected when clicking ‘New Toipic’ from the WPS forums hopme page it will default to showing the ‘Sun Dresses’ forum as the destination for my topic unless I select another forum?

    If that is the case then we can ignore this as we do not have that functionality in bbPress.

    ā€˜Allow new topicsā€™ will basically close the category to new topics. Likewise, in a topic thereā€™s a checkbox to allow new replies or close the topic.

    I already implemented this for topics and partially for forums, I will fix this for forums shortly.

    ā€˜remote_addrā€™ is for monitoring spammers, I donā€™t think it deserves much interest in importing forum content as itā€™s mainly a short-time asset.

    We do use IP addresses for Akismet and spam protection, we have some upcoming updates for this that will also take into account the users existing history on the site and from emory this can include the users IP address so I will take a look and see what can be done to add support for IPv6 as currently we only support IPv4.

    Iā€™ll go through your callback functions tomorrow, but a quick comment about values in WPS: they are either ā€˜onā€™ or anything else, possibly not set, so itā€™s better to revert the switch and test against the ā€œcase ā€˜onā€™ā€ and any other ā€œdefaultā€ ?

    That is what I have done for closed topics and will do the same for closed forums.

    The group forum post from my demo install was converted. In the list of topics it is indicated as ā€˜no forumā€™ which is true (as per my previous post). We should either create a forum (named like the group itself for instance) or discard group forums topics altogether (WHERE symposium_topics.topic_group != 0).

    phpBB has a similar sceanrio for a special sticky post, it is not assigned a forum. bbPress supports topics not having a forum so this technically doesn’t break things but we don’t have a ‘view’ that can show us topic s that are not in a forum.

    I haven’t tried the WPS groups but I will create one and see what we can (or cannot) do with them.

    About importing users, you raise an interesting point. Iā€™d like to understand if this tool is a converter or an importer. Being located in a folder called /converter/ I had assumed it should work within the same WordPress install and convert it from one plugin to another, but you seem to move it towards the import of data accross platforms. Incidentally, I have been wondering why I need to fill the ā€˜Database Settingsā€™ with db name / user / password / prefix, while Iā€™m converting an existing forum within the same base. Iā€™m happy with both, although I would tend to consider that most WP-to-WP imports will be performed within the same siteā€¦?

    I would say it is more importer than converter though interchanging those terms is not much of a stretch as we do not only import stuff we also convert stuff then import :/

    In total aside from WPS the only other importers that are also plugins ontop of WordPress are Mingle and SimplePress, the other 23 in most sceanarios would be a seperate database from the WordPress database. To extend the same issue I stated previously on how to handle users the same case applies, you are not explicitly limited to adding the bbPress plugin to your existing WP/WPS install and importing your data, you can also create a fresh WordPress install with a fresh database and import your data into that. So in theory we could ‘hide’ the database settings IF we knew your intented scenario before the fact. It would be nice in a future iteration to make the importer a ‘step by step wizard’ and we could then do such things and many more things to make the process a little less daunting…

    The other topics Iā€™d like to bring at some point in our discussion are the attachments and the avatars. Iā€™m not sure yet how bbPress handles attachments, for WPS they are physically stored in a location set from the ā€œparamsā€ tab, and displayed either online or as links (depending on a setting). As far as avatars, once WPS is deactivated they are all gone, is anything possible or is this too dependent upon the plugin the admin may install for avatars ?

    There is a post in the Kunena importer thread where @cybnet has written an attachment importer with details on how to change it for your own Kunena forum. The source is here and no doubt could be adapted for WPS.

    Kunena converter for bbPress 2.4

    Kunena converter for bbPress 2.4


    https://github.com/cybnet/kunena-attachments-to-bbpress/blob/master/kunena-attachments-to-bbpress.php

    Edit: I should have added that bbPress does not include support for attachments, there is one or two plugins that do add support for attachments so I would look to using one of those and use that plugins architecture to facilitate how the attachments are handled. We’d like to support attachments in bbPress ‘one day’ though we have some bigger implementation details to work out before we have a crack at this.

    Avatars are a bit trickier as bbPress nor WordPress do not support custom avatars for user profiles out of the box. There are many plugins for this so at the moment this is not something we can support. We can’t make avatar import support the hundres of avatar plugins available.


    lagrou
    Participant

    @lagrou

    First, not sure what’s the best way to proceed with updates at GitHub. Could you create a pull request, shall I fork your own repo or create a new branch, or simply update my own master ?

    if I understand correctly is that I could choose the ā€˜Sun Dreessesā€™ forum to be the default forum selected when clicking ā€˜New Toipicā€™ from the WPS forums hopme page it will default to showing the ā€˜Sun Dressesā€™ forum as the destination for my topic unless I select another forum?

    Yes, the form will default to that category in its dropdown list of categories. It’s of little use, and as you stress, we can ignore this. I was only clarifying forum vs. categories in WPS, and why we can drop callback_forum_type() in your update of the converter / importer.

    I havenā€™t tried the WPS groups but I will create one and see what we can (or cannot) do with them.

    I considered that the content could at least be imported, then the admin would do whatever he wants to with that content. But maybe the groups ownership and membership will be impossible to mimick at bbPress level solely, so it’s better to avoid importing rather than making public content that was private to begin with…?

    I’m adding a Users section to your own version of the converter module (based on other converters available). If we want to import user-related settings, like forums/topics subscriptions and favorites, is this possible ? WPS uses usermeta, and I would assume bbPress does so…?

    Your last comment about attachements and avatars is well noted, I’ll check what could be done outside of bbPress.


    lagrou
    Participant

    @lagrou

    Back to topic, just updated the GitHub repo with the following:
    – Add User section
    – Fix & make use of callback_forum_status, add Forum status (Open or Closed)
    – Fix & make use of callback_sticky_status
    All this tested OK on my nested test install. I’m leaving the “pre-alpha code” warning, though.

    Some more questions raised at this stage:
    – How do you access a parentless topic in bbPress ? Could these be used for WP Symposium groups forum topics ?
    – Could you clarify what a forum and a category refer to, in bbPress terminology ? Is a category a subforum, which has necessarily a parent forum, while a forum has no parent ? In such a case, there should be a test over symposium_cats.cat_parent in callback_forum_type(), otherwise it can be simply disregarded…


    lagrou
    Participant

    @lagrou

    I forgot to mention that while “repairing missong information”, I got the following error message several times, not sure where it comes from:
    WordPress database error: [Table ‘xxx.wp_bp_groups_groupmeta’ doesn’t exist]

    Other than that, as of tonight the WPS > bbP converter / importer works for the following:
    – WPS categories, parent / child
    – topics, sticky topics
    – replies
    – users

    Yet to be done:
    – Groups forums (either drop topics, leave them as parentless, or create hidden forums as per the group name)
    – user meta (forum subscriptions, favorites)
    Anything else ?

    I considered that the content could at least be imported, then the admin would do whatever he wants to with that content. But maybe the groups ownership and membership will be impossible to mimick at bbPress level solely, so itā€™s better to avoid importing rather than making public content that was private to begin withā€¦?

    – Groups forums (either drop topics, leave them as parentless, or create hidden forums as per the group name)

    I don’t think leaving them parentless is the best way to go, maybe creating a hidden forum might be the way to go. Let’s leave this out for now, we can revisit this in the future easily enough and get v1 out and revisit this for v2.

    Iā€™m adding a Users section to your own version of the converter module (based on other converters available). If we want to import user-related settings, like forums/topics subscriptions and favorites, is this possible ? WPS uses usermeta, and I would assume bbPress does soā€¦?

    – user meta (forum subscriptions, favorites)

    Yes, mainly, I haven’t looked at importing subscriptions or favorites yet in any of the importers, will get there one day.

    What you have added looks fine via your latest commit here.

    WordPress database error: [Table ‘xxx.wp_bp_groups_groupmeta’ doesn’t exist]

    You only get this error if you don’t have BuddyPress installed and activated, I need to add some inline docs for this and help docs.

    How do you access a parentless topic in bbPress ? Could these be used for WP Symposium groups forum topics ?

    You will see them in the topic list in the backend, you won’t see them on the front end unless you make them a sticky or know the url but they will be publicly accessible. Finding them in the backend is not so easy unless you know the title of the topic. Not the best experience, but also was never really planned for, it was just never enforced that a topic must have a forum either.

    – Could you clarify what a forum and a category refer to, in bbPress terminology ? Is a category a subforum, which has necessarily a parent forum, while a forum has no parent ? In such a case, there should be a test over symposium_cats.cat_parent in callback_forum_type(), otherwise it can be simply disregardedā€¦

    Both a forum and a category can have sub forums or sub categories, forums can have topics, categories cannot have topics.

    Thus symposium_cats.cat_parent is already being used with _bbp_forum_parent_id and this is how we get the forums, sub-forums, categories etc all ordered correctly in their correct nested levels.

    I think we are good, I’ll grab the latest shortly and the patch to bbPress Trac Ticket #2603 and I’ll take it for a test drive then commit it and it will be part of bbPress v2.6.


    lagrou
    Participant

    @lagrou

    Thanks for everything Stephen šŸ˜‰

    I donā€™t think leaving them parentless is the best way to go, maybe creating a hidden forum might be the way to go. Letā€™s leave this out for now, we can revisit this in the future easily enough and get v1 out and revisit this for v2.

    Hmm, the current behaviour is groups forum topics are left parentless, so v1 should either exclude them from import (symposium_topics.topic_group != 0) or create hidden forums…

    Both a forum and a category can have sub forums or sub categories, forums can have topics, categories cannot have topics.

    OK so WPS categories == bbPress forums, that’s what we have.

    Something else that could be added to the TODO list: in WPS forums, replies can have so-called comments, which are basically 2nd-level replies. Could be worth adding this to the importer as they’re most often used in the conversation. As I wasn’t using this for my own purpose I have yet to find how they are implemented !

    FWIW, WPS version numbers refer to the year/month they were issued. I would assume little to nothing has changed in the last few years regarding database structure.

    Ok, I’ll take a look at the groups shortly, my computer is being stupid at the moment and isn’t playing nice šŸ™

    ‘Reply to Replies’ / ‘2nd level replies’, we can do this easily, we support ‘threaded replies’, I can’t find how to make one or a setting though :/

    Basically ‘whatever’ version procedure they use, I will reference that, kind of not important at our end except to say we tested with ‘x’ version.


    lagrou
    Participant

    @lagrou

    Merged your pull request…

    Reply to Replies, I had a look and they are stored in symposium_topics like other replies, so we should have them with little effort. In case you’d like to give it a try on WPS side, and be able to test their import, they are activated using roles, “Forum comment roles” under “Forum” tab.

    I’ll be happy to contribute to the bbPress Codex as well, with issues etc. Browsing other converters’ Codex, I do see where there will be issues with WP Symposium, [youtube], custom smilies {{cloud}}, etc.

    EDIT: oops fixed a copy/paste error in my prose…


    lagrou
    Participant

    @lagrou

    Something odd about those “replies to replies”. I had assumed they would be there by default, but couldn’t see them…

    I’ve added some ‘replies to replies’ to my test WPS forum before converting it… In bbPress, in the backend they are not displayed in the list of replies, although I do see ‘hidden’ replies in the count that I cannot access to. In the frontend, the forum topic does not show those replies, nor do the counters. However!! When dumping wp_posts table WHERE post_type = ‘reply’, they are there, so they were converted ok, it’s just that they don’t show. I did set bbPress threated replies 2 levels deep before conversion. Any advice…?

    As far as groups forum topics, I would add ‘AND symposium_topics.topic_group = 0 ‘ to the ‘from_expression’ of both the topic ID and Reply ID sections to get rid of those posts. Cleaner until v2.

    Reply to Replies, I had a look and they are stored in symposium_topics like other replies, so we should have them with little effort. In case youā€™d like to give it a try on WPS side, and be able to test their import, they are activated using roles, ā€œForum comment rolesā€ under ā€œForumā€ tab.

    Iā€™ve added some ā€˜replies to repliesā€™ to my test WPS forum before converting itā€¦ In bbPress, in the backend they are not displayed in the list of replies, although I do see ā€˜hiddenā€™ replies in the count that I cannot access to. In the frontend, the forum topic does not show those replies, nor do the counters. However!! When dumping wp_posts table WHERE post_type = ā€˜replyā€™, they are there, so they were converted ok, itā€™s just that they donā€™t show. I did set bbPress threated replies 2 levels deep before conversion. Any adviceā€¦?

    Looking at this now, threaded replies are using the same topic_parent field, though they are using this as a pointer to the ‘reply parent’ rather than the topic parent.

    This is the reply query: (My test results) Notice the ‘threaded replies’ topic ID, it is not the actual topic ID it is the reply ID they are a reply to.

    
    SELECT CONVERT( symposium_topics.tid
    USING  "utf8" ) AS tid, CONVERT( symposium_topics.topic_category
    USING  "utf8" ) AS topic_category, CONVERT( symposium_topics.topic_parent
    USING  "utf8" ) AS topic_parent, CONVERT( symposium_topics.topic_owner
    USING  "utf8" ) AS topic_owner, CONVERT( symposium_topics.topic_post
    USING  "utf8" ) AS topic_post, CONVERT( symposium_topics.topic_started
    USING  "utf8" ) AS topic_started
    FROM wp_symposium_topics AS symposium_topics
    WHERE symposium_topics.topic_parent !=0
    LIMIT 0 , 100
    

    Working on tweaking the query now….

    Iā€™ll be happy to contribute to the bbPress Codex as well, with issues etc.

    Appreciated šŸ™‚

    Browsing other convertersā€™ Codex, I do see where there will be issues with WP Symposium, [youtube], custom smilies {{cloud}}, etc.

    I haven’t looked at this yet, most of it should be easy enough from work on the other importers, just a matter of creating a list of all that is required.

    As far as groups forum topics, I would add ā€˜AND symposium_topics.topic_group = 0 ā€˜ to the ā€˜from_expressionā€™ of both the topic ID and Reply ID sections to get rid of those posts. Cleaner until v2.

    I’ll add that shortly and do some tests.

    It looks like we won’t get the threaded replies in v1, I had a similar issue with vBulletin 5 and which is not included in bbPress at this stage. Trying to get a single query to handle all of the replies doesn’t look good at the moment for WPS.

    You can take a look at the vBulletin5.php importer, rather than just ‘Forums’, ‘Topics’ and ‘Replies’ sections I had to add a 4th, ‘Comments’ this then meant I had to extend the main converter to handle this extra step.

    https://bbpress.trac.wordpress.org/attachment/ticket/2440/

    I’ll have a think about this over the next couple of days and come up with some options, there is a chance I can add this extra section to bbPress and then included WPS threaded replies, vBulletin5.php in the next version of bbPress. There is just a ton of testing needed to ensure the ~20 other importers continue to work and fix any issues that arise…


    lagrou
    Participant

    @lagrou

    Looking at this now, threaded replies are using the same topic_parent field, though they are using this as a pointer to the ā€˜reply parentā€™ rather than the topic parent.

    Confirmed. To select first-level replies only, that would be using SQL:

    "SELECT * FROM wp_symposium_topics WHERE topic_group = 0 AND topic_parent IN (SELECT tid FROM wp_symposium_topics WHERE topic_parent = 0)"

    And to select second-level replies only:

    "SELECT * FROM wp_symposium_topics WHERE topic_parent != 0 AND topic_group = 0 AND topic_parent NOT IN (SELECT tid FROM wp_symposium_topics WHERE topic_parent = 0)"

    Note that I’m excluding groups forum. Now, how to mimick this with the converter?


    lagrou
    Participant

    @lagrou

    Problem I see, is that with this version all of the replies are imported, including second-level ones which have the topic ID as parent instead of their parent ID. Not sure if this is related, but on my test install when there are second-level replies to import it messes bbPress list of replies. Whereas with no second-level replies in WPS forum, it works fine.

    To get only first-level replies, I have changed the above into:
    "SELECT s.* FROM wp_symposium_topics s INNER JOIN wp_symposium_topics t ON s.topic_parent = t.tid WHERE s.topic_parent != 0 AND s.topic_group = 0 AND t.topic_parent = 0"

    Which works fine as dumped in a PHP page. And then into:

    // Reply id (Stored in postmeta)
    $this->field_map[] = array(
    	'from_tablename'  => 'symposium_topics s',
    	'from_fieldname'  => 'tid',
    	'join_tablename'  => 'symposium_topics t',
    	'join_type'       => 'INNER',
    	'join_expression' => 'ON s.topic_parent = t.tid',
    	'from_expression' => 'WHERE s.topic_parent != 0 AND s.topic_group = 0 AND t.topic_parent = 0',
    	'to_type'         => 'reply',
    	'to_fieldname'    => '_bbp_post_id'
    );

    Unfortunately, it seems the converter doesn’t accept this…

    EDIT: do not believe I haven’t read your own posts LOL. I just wanted to describe the path I have followed in case it would bring some light on your side…

    Not sure if this is related, but on my test install when there are second-level replies to import it messes bbPress list of replies.

    Yes, saw the same thing, because the replies it tries to list are linking to parent topics that do not exist.

    EDIT: do not believe I havenā€™t read your own posts LOL. I just wanted to describe the path I have followed in case it would bring some light on your sideā€¦

    Thinking ‘out loud’ is all good, helps ideas for even funkier SQL queries šŸ˜‰

    Unfortunately, it seems the converter doesnā€™t accept thisā€¦

    No it doesn’t, it is pretty limited in how we can do joins and joining a table with the same name it ignores when it comes time to merge all the sections field mappings. We can work around this for now by putting all of the join bits in the from_expression thus the following works:

    
    'from_expression' => 'INNER JOIN wp_symposium_topics t ON symposium_topics.topic_parent = t.tid WHERE symposium_topics.topic_parent != 0 AND symposium_topics.topic_group = 0 AND t.topic_parent = 0',
    

    I also setup some groups (and what a painful experience that was), I agree it would be nice to get the group topics imported also but lets do that in v2 after I add some of the previously mentioned changes to improve the capabilities of the main converter script.

    Pull request sent with above change…

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