Are you trying to append to the content of the main topic content (the lead), or to all replies within a topic?
As a first goal I would like to be able to alter the content of each reply shown on the topic page. So actually that would include the lead topic post (in bbpress terms the OP is the topic and subsequent posts are the replies, yeah?)
I think I would also need to know the reply’s ID and whether it was the first reply. If I can get a basic template for that I reckon I can get going with the rest 🙂
There are two plugins I built for e107 and I would like to have a go at bbpress 2 versions. One is a ‘Thanks’ plugin, so I’d need to eg add a “thank this post” button to each post, and show a user’s ‘thanks’ count next to their name.
The other is an adense plugin which popped an ad unit inbetween the OP and first reply.
Many Thanks.
-
This reply was modified 12 years, 3 months ago by jezza101.
Here’s a really basic way of how you can do it: https://gist.github.com/3788409
Thanks Pip. Starting to make some progress. I’ve been playing around with some other filters and beginning to explore, I can see how to manipulate various components of a post.
But I’ve hit a brick wall, do you know how to insert something between the first and second post for example?
My goal is to inject a “dummy post” which had the same template as a normal post but contained my own message.
Many thanks.
I would suggest you simply append it to the content of the lead topic.
OK, so to do that I would have to close the post myself, which looks like I just have to add two x divs
Div <!-- .bbp-reply-content -->
Div
But it looks like HTML filters are being applied still – ah, is this a case of ordering things so that my filter comes right at the end, ie after the HTML filter?
..ah a quick test and, yes, this seems to work.
$content=$content.'TEST1(/div)(/div)IS THIS BETWEEN POSTS? YES!(div)(div)';
Ah apologies, the forum filter has filtered out the DIVs above.. putting them back in with curly brackets.
Excellent. Looks like I need to put some thought into how to make it look good but I think I can work on that! One last question then (sorry, and thanks for your help!), how do I pick out the first post?
-
This reply was modified 12 years, 2 months ago by jezza101.
Off the top of my head I’m not sure, but tinker with it a little and report back. I’ll be traveling for a day or two, but I can try tinkering with it when I get back.
Thanks loads, I’m definitely on my way now. If I can just identify the first post then I’ve got everything I need.
I guess I could just set a global flag once we’ve done the first loop to say don’t process my function again – but that doesn’t seem particularly elegant!
Cheers, will definitely pop a credit / link in when I get this out.