Tag Archives: attachments

Forum Attachments for BuddyPress

This plugin ives members the ability to upload attachments on their posts.

It’s a port of a plugin originally created for bbPress by _ck_. See the original plugin page here: http://bbpress.org/plugins/topic/bb-attachments/. _ck_ is not supporting this plugin anymore. Insofar as the code works, it is thanks to her; insofar as it does not, it is my fault.

Installation

  • Upload to plugin directory and activate
  • If you’d like to change the default settings (as described in step 5 here http://bbpress.org/plugins/topic/bb-attachments/installation/), you may do so by editing forum-attachments-for-buddypress-bp-functions.php
  • Create a directory ‘bb-attachments’ one level above your WP root and make sure that it is writeable by the server. So if your WP installation is at /home/html/, create a directory /home/bb-attachments.
  • I use a JavaScript trick to make uploads possible. If you are confident that most of your users will have JS enabled, you do not need to do anything else.
  • If you want to make uploads possible for users with JS turned off, you will need to alter the <form> tags on your theme’s forum files: groups/single/forum/topic.php and groups/single/forum.php. Change
    <form action="" method="post" id="forum-topic-form" class="standard-form">

    to

    <form action="" method="post" id="forum-topic-form" class="standard-form" enctype="multipart/form-data">
  • If you have an unusual setup (in particular, if your WP_PLUGIN_URL is somewhere other than /wp-content/) you may have to play with the path settings in download.php and image.php to make things work correctly.

Read an older comment thread about this plugin.

Download the plugin here.

Forum Attachments for BuddyPress has been downloaded 9,665 times. Are you using this plugin? Consider a donation.

Translation credits

  • Russian – slaFFik

Version history

0.1
Initial release
0.2 – March 19, 2010
BuddyPress 1.2 compatible
Removed the need for custom theme hooks
Enabled inline images
Improved download process to avoid header conflicts
0.2.1 – March 19, 2010
Corrected redirect after deleting attachments
Removed header requirements causing errors on some Apache setups
0.2.2 – March 22, 2010
Corrected typo that was causing redirect conflicts with certain forum-related plugins

Forum Attachments for BuddyPress

I posted about this a while ago, but I have ported _ck_’s bb_attachments plugin to BP 1.1.x. I took some time today to clean up the readme files and submit the plugin to the wordpress.com plugin database. Nothing about the plugin itself, or the hooks you’ll have to put into your theme, has changed since my last post; but at least now you’ll receive the file with full documentation and can use the WP plugin installer to install and maintain this bad boy.

Get it here or by searching for “forum attachments” on WP’s Add New Plugin page.

Bug reports (and especially patches!) are welcome.

Help me alpha test BuddyPress Forum Attachments

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.

  1. Download the plugin bb-attachments.php.zip
  2. Unzip and upload to your WPMU plugin directory. Activate it.
  3. 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">
  4. 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)
  5. 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.
  6. 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.