Support » Plugin: bbPress Topics for Posts » [Plugin: bbPress Topics for Posts] Does it work with custom post types?

  • Resolved kuching

    (@substrato)


    I’ve installed bbPress 2.1 in WordPress 3.3.1

    I have downloaded the latest Topics for Posts plugin and installed it

    I have configured it to create new topics for new comments placed on my posts. However I can’t see it working.

    Suppose I create a new post in a custom post types of mine (my setup has several). In the discussion panel I tick the option to create a new topic for it. Then I save my post and check the forum: nothing. I try to comment my own post: nothing. Nothing does show up in forums. If I comment to my own post, a regular comment will show up and that’s it. Like the plugin never existed.

    So I’m wondering what is this plugin supposed to do, am I doing something wrong in handling it?

    Is it supposed to start a new forum thread as soon as a new post (belonging to any post type) is published? Or is it supposed to start one only when someone “comments” it for the first time?

    Nevertheless I didn’t see it working in either way. I would really like to have this plugin working… If custom post types are not supported I would gladly donate to fund some further development on this plugin.

    Should I do something with my template files to show forum thread below the post and replace the comment box with a forum post box? (bbpress or wordpress)

    any help?

    thank you! 🙂

    http://wordpress.org/extend/plugins/bbpress-post-topics/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author David Dean

    (@ddean)

    You aren’t doing anything wrong! 🙂

    By default, the plugin will only create topics for posts or pages. But, as you’ve seen, it will display for any type that has a “Discussion” metabox. It’s definitely an area that could use some UI attention, but I didn’t want to try to make a list of “approved” custom types in the mean time.

    Try creating a function to hook the filter bbppt_eligible_post_types, and add your custom post type to the array it takes. That will turn on processing for your post type, and everything should be OK. Let me know if you run into anything or if you have any more questions!

    Hi David,

    actually I did see the replacement for the “Discussion” metabox. It shows up in all my post types. I also selected the forum where I wish discussion to appear. But nothing happens in the front end when I publish a new post or update a previous one. I still see the standard comment box (frontend). If I submit a comment from there, it’s published as a comment, not as discussion in the forums. Also, no new discussion threads are created in the forums, if I check from there.

    I tried to add a filter as you suggested

    function sg_comments_to_posts_types($args) {
        $args = array('post', 'accommodation', 'article', 'event', 'nightlife', 'dining', 'activity', 'heritage', 'hiking', 'recurrence', 'news', 'feedback');
    }
    add_filter( 'bbppt_eligible_post_types', 'sg_comments_to_posts_types');

    but it returns the error

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'sg_comments_to_post_types' was given in /home/ntds/public_html/wp-includes/plugin.php on line 170

    any clues?

    I filtered the function in this other way:

    add_filter( 'bbppt_eligible_post_types', create_function( '$post_types', 'return array("post", "accommodation", "article", "class", "dining", "event", "heritage", "hiking", "news", "nightlife", "recurrence");' ) );

    this seems to work and eventually I have finally a proper discussion box replacying my comment box; also discussion threads are being created in my forum for my post types

    HOWEVER… everytime I attempt to save a post, WordPress throws this error:

    Warning: Can't determine direction in /home/ntds/public_html/content/plugins/posts-to-posts/core/type.php on line 88
    
    Warning: Invalid argument supplied for foreach() in /home/ntds/public_html/content/plugins/posts-to-posts/admin/box-factory.php on line 135
    
    Warning: Can't determine direction in /home/ntds/public_html/content/plugins/posts-to-posts/core/type.php on line 88
    
    Warning: Invalid argument supplied for foreach() in /home/ntds/public_html/content/plugins/posts-to-posts/admin/box-factory.php on line 135
    
    Warning: Can't determine direction in /home/ntds/public_html/content/plugins/posts-to-posts/core/type.php on line 88
    
    Warning: Invalid argument supplied for foreach() in /home/ntds/public_html/content/plugins/posts-to-posts/admin/box-factory.php on line 135
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/ntds/public_html/content/plugins/posts-to-posts/core/type.php:88) in /home/ntds/public_html/wp-includes/pluggable.php on line 866

    the plugin WordPress is mentioning is “Posts2Posts”
    http://wordpress.org/extend/plugins/posts-to-posts/ a WordPress plugin by Scribu

    That plugin is very useful… and I need to retain both plugins in my setup

    I will notify Scribu as well to determine the nature of the error

    Watching with great interest to see if anyone can figure this out.

    No luck from my end so far.

    @melbouy if your issue is to activate BBTopics4Posts for post types, the filter mentioned above should work… it does for me; however it introduces a conflict with Posts2Posts (and I don’t know if with other plugins as well. The plugins will work, but upon saving the post an error screen is displayed. Post will be saved correctly and forum discussion will be created. I haven’t checked if this will harm Post2Posts relationships for that specific post though.

    Hi substrato, I managed to get this working with my custom post type simply by adding its name to the bbppt_eligible_post_types array on line #156 of the plugin file (as above).

    Embarrassingly, my stumbling block was that I had capitalised my custom post type (“TEF_Video”).

    Live & learn.

    ok that also will work, but if you hardcode your post types in the plugin files, it means when the plugin will be updated, you will lose your customisation – you should filter the plugin by inserting the php code mentioned in your functions.php file

    as a matter of fact even hardcoding the post types will issue a warning when Posts2Posts is active on the same topic, so my problem is still open

    @substrato:

    What version of Posts 2 Posts are you using?

    Please use http://pastebin.com to share your p2p_register_connection_type() calls and whatever else code related to P2P you might have.

    sure, here it is:

    http://pastebin.com/7a1XpD2M

    P2P is 1.1.5
    Wordpress is 3.3.1

    the warnings I mentioned above do not show up under other circumstances, only since I started using Posts to Topics plugin

    bbPress Topics for Posts was updated today by plugin author to v1.1, changelog says added support to bbPress 2.1, which is what I’m running

    however the problem with P2P plugin persists

    Please also update P2P to the development version (1.2-alpha).

    did it, not lucky, still throws the warning message

    the warning message won’t show if I update/save the post again after setting the forum discussion for the first time (ie postdata gets saved despite the warning messages and in future it won’t display again apparently) – this behaviour didn’t change from last time despite the 1.2-alpha update

    Found the bug in P2P. Should be fixed in 1.2-alpha2.

    yes!! it appears to be working now 🙂 thanks!

    what was the bug that caused the warning being issued?

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: bbPress Topics for Posts] Does it work with custom post types?’ is closed to new replies.