lagrou (@lagrou)

Forum Replies Created

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

  • 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…


    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

    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.


    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

    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.


    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 ?


    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

    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

    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 ?


    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.


    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…

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