Now that bbPress is integrated into the Very Fabric of BuddyPress, there’s some demand for useful bbPress plugins to be ported over to BP. One of the most useful is _ck_’s excellent bb-attachments, which allows users to add attachments to their forum posts. I have spent a bit of time in the last few days porting it over to BP. If anyone out there is running a BP+bbPress setup (I think it should work in any recent version of BP, but I’ve only tested in BP 1.1) and would like to help me to test what is I think a functional BP version of the plugin, please do so. Here are the details.
- Download the plugin bb-attachments.php.zip
- Unzip and upload to your WPMU plugin directory. Activate it.
- You’ll have to make a few changes/additions to your theme files to make it work. In your BP theme directory, go to groups/single/forum/topic.php. On line 9, after the ‘template_notices’ hook, add
<?php do_action( 'topic_page_load' ) ?>
Next: After line 61, which reads
<?php bp_the_topic_post_content() ?>
insert the following line
<?php do_action( 'bp_after_post_content' ); ?>
Next: On line 26, replace
<form action="<?php bp_forum_topic_action() ?>" method="post" id="forum-topic-form" class="standard-form">
with
<form action="<?php bp_forum_topic_action() ?>" method="post" id="forum-topic-form" class="standard-form" enctype="multipart/form-data">
- In the same theme directory, open edit.php and index.php. Find the <form> tags, as described in the last part of the previous step, and replace them with the alternative <form> tag (with the enctype specified)
- Follow steps 1 and 2 from here. Step 5 on that page (the “optional settings”) you can do as well, and those settings might take some tweaking for certain filetypes to be allowed.
- Start uploading!
A few caveats:
- I have not tested any of the AWS abilities. It’s possible that they will still work, as the AWS functionality is more or less abstracted from the specific bbPress hooks.
- Inline images are not yet supported. I’m working on it.
- Things look a little bit ugly with the default BP 1.1 theme. I haven’t done much to make it pretty. I’m happy to take aesthetic suggestions, if you have any.
Thanks in advance for your help. Please leave any comments here in this post’s thread.
Related posts:
Just an FYI, do not confuse me (r-a-y) with “avatar” Ray above me! ;)
so… doesn’t work in BP 1.2.1, right?
based on:
- there’s no index.php in groups/single/forum/ anymore
- there’s no ‘template_notices’ hook in topics.php
anyone ported this yet or know of something with a similar capability that is BP 1.2.1 compatible?
Hi gever. I haven’t even looked at how the code works in BP 1.2+. r-a-y says above that the basic functionality (the uploading parts) still work fine, but the new bp-default theme is sufficiently different that it will probably take a fair amount of work to make all of the UI parts appear correctly.
r-a-y – Sorry for ignoring your comment for so long. I think that really I just want to ignore this plugin, as it has caused me some nightmares. In any case, you might need to make sure that the cache function is being hooked to a function that actually exists, otherwise the refresh won’t happen. I will look at the code sometime next week and let you know what I find. Ideally I’ll release something fully 1.2 compatible (and by “fully” I mean “as bug-free as my code ever gets)
Avatar Ray – I have no idea what the problem is, but as long as it’s working, I’ll put that bug fairly low on my todo list :)
Hi
I really don’t get this – cannot find any of the code you refer to for altering as in the instructions at the top of this page!
I am running latest version of single install of wordpress with the new version of buddypress written for this system.
I have forums enabled in buddypress which uses a bbpress install. The forums etc works ok.
I want to be able to add attachment with the forum posts but it isn’t working. It throws up errors on the screen, and although the new reply can be accessed the uploaded files are nowhere to be seen!
I am fairly new to all of this which dosen’t help.
Please can you help me?
Cheers
Emma
?
Emma – this plugin has not yet been updated for the newest versions of BP. Others have told me that it’s possible to make this version of the plugin work with BP 1.2.1, but it takes a bit of knowledge of how templates work.
I’ll be having a look at this plugin within the next week or two and will post an update on my blog when I’ve got it working properly.
Thanks Boone
I just don’t have the know how (yet – something to work on!) but it would be a really useful plugin for me if it worked :) Will keep an eye on your blog.
Emma
Not sure whether anyone is following this thread, but if so, please note that I have posted a new version of the plugin that should be quite compatible with BP 1.2: http://teleogistic.net/code/buddypress/forum-attachments-for-buddypress/. Any future comments about the plugin should go on that thread.