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!
Thread Starter
kuching
(@substrato)
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
Thread Starter
kuching
(@substrato)
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.
Thread Starter
kuching
(@substrato)
@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.
Thread Starter
kuching
(@substrato)
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.
Thread Starter
kuching
(@substrato)
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
Thread Starter
kuching
(@substrato)
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).
Thread Starter
kuching
(@substrato)
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.
Thread Starter
kuching
(@substrato)
yes!! it appears to be working now π thanks!
what was the bug that caused the warning being issued?