WordPress.org

Ready to get started?Download WordPress

Forums

bbPress Topics for Posts
[resolved] Does it work with custom post types? (19 posts)

  1. kuching
    Member
    Posted 2 years ago #

    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/

  2. David Dean
    Member
    Plugin Author

    Posted 2 years ago #

    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!

  3. kuching
    Member
    Posted 2 years ago #

    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
  4. kuching
    Member
    Posted 2 years ago #

    any clues?

  5. kuching
    Member
    Posted 2 years ago #

    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

  6. melbouy
    Member
    Posted 2 years ago #

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

    No luck from my end so far.

  7. kuching
    Member
    Posted 2 years ago #

    @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.

  8. melbouy
    Member
    Posted 2 years ago #

    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.

  9. kuching
    Member
    Posted 2 years ago #

    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

  10. scribu
    Member
    Posted 2 years ago #

    @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.

  11. kuching
    Member
    Posted 2 years ago #

    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

  12. kuching
    Member
    Posted 2 years ago #

    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

  13. scribu
    Member
    Posted 2 years ago #

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

  14. kuching
    Member
    Posted 2 years ago #

    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

  15. scribu
    Member
    Posted 2 years ago #

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

  16. kuching
    Member
    Posted 2 years ago #

    yes!! it appears to be working now :) thanks!

    what was the bug that caused the warning being issued?

  17. scribu
    Member
    Posted 2 years ago #

    I was using a convoluted way to save connection meta.

    It didn't really have anything to do with the bbPress Topics For Posts plugin.

  18. kuching
    Member
    Posted 2 years ago #

    glad you fixed it then

  19. rajseelam
    Member
    Posted 1 year ago #

    Which file and where exactly should I add the filter? You guys might know it already but I don't see you mentioned it anywhere.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic