Skip to content

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 8,759 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

165 Responses to Forum Attachments for BuddyPress

  1. AntonRSA says:

    Thanks for the great plugin Boone. It doesn’t seem to work on IE but it does in Firefox. Is there a fix for this?

  2. Dia Ritoch says:

    Hi, I like your plugin very much. The thing is, I would like to make a dailybooth-like forum in my buddypress site. It is not multi-site. I want my other forums to NOT contain a file-attachment feature and would only like it to work for my Photo forum. Is there any tweaking I should be doing? Coz if I activate it, it naturally works on all the forums.

    Please help me :)

    Dia

  3. Boone Gorges says:

    Hi Dia,

    Yes, that’s possible. Find the group of add_action lines around 193. Replace those lines with the following:

    
    global $bp;
    if ( $bp->groups->current_group->slug == 'my-group-slug' ) {
    	add_action( 'groups_forum_new_topic_after', 'bb_attachments_upload_form' );
    	add_action( 'groups_forum_new_reply_after',  'bb_attachments_upload_form' );
    	add_action( 'groups_forum_edit_post_after',  'bb_attachments_upload_form' );
    	add_action( 'bp_after_group_forum_post_new',  'bb_attachments_upload_form' );
    	add_action( 'bp_group_after_edit_forum_post',  'bb_attachments_upload_form' );
    	add_action( 'pre_post_form', 'bb_attachments_enctype' );	 // multipart workaround on new post form
    }
    

    You’ll have to replace ‘my-group-slug’ with the slug of the group where you want uploads to be activated.

  4. Dia Ritoch says:

    Mr. Boone,

    Thank you SO VERY MUCH! It worked!!!!! Now I can have my own dailybooth-like forum using buddypress!

    Dia

  5. Hi Boone,

    Remember me? I am Ralf, the guy you helped out about a month ago. Unfortunately my hosting company screwed some stuff up, which meant I had to reinstall a backup. So now the thumbs aren’t working anymore. Could you repeat that trick one more time for me? Ill be forever greatful. Also Ill make a backup after you did it this time … ^^

    Thanks in advance

  6. Hi Boone! Are you still alive? ^^

  7. Boone Gorges says:

    I’m alive but I don’t remember what I did to fix the plugin. Are the creds you sent me last time still valid?

  8. Yes they are! Thanks for the support. this must be annoying for you…

  9. Hi Boone,

    I’m guessing you are very busy… so if you could just tell me what you did, then I will try to fix it myself. In case you can’t remember, my creds are still the same.

    Cheers,

  10. Boone Gorges says:

    As I said above, I don’t remember what I did, so I have to find a moment when I have some time to go back in and reengineer the fix. I’ll let you know.

  11. Ricky says:

    Boone,
    Excited to set this plugin up. I followed the instructions. I have a WP3.0 and BP 1.2.5 install. Using a custom theme but I don’t even see the image upload option in either my groups or forums. Any ideas? I put two bb-attachments folders in and set to 775. One at the same folder as my public_html and the other in public_html. My wordpress files are located in public_html.

    Any ideas?

  12. Ralf says:

    Hi Boone,

    Any progress?

    Ralf

  13. Nigel says:

    This could be a useful plugin as there are so few ways for WordPress to upload files for/from users. I’m using latest version of your plugin and latest versions of WP/Buddypress/bbPress. On trying to upload a file I get this error message although the file itself has been uploaded!?

    http://www.scannote.com/groups//
    Warning: Invalid argument supplied for foreach() in mydirectory/scannote.com/wp-content/plugins/buddypressbbpress-email-notification/bn-bb-notification.php on line 42

    Warning: Cannot modify header information – headers already sent by (output started at mydirectory/scannote.com/wp-content/plugins/buddypress/bp-groups/bp-groups-templatetags.php:331) in mydirectory/scannote.com/wp-includes/pluggable.php on line 890

    I have the following plugins installed relevant to the forum and BuddyPress: Forum Post Notification,Enhanced BuddyPress Widgets,BuddyPress Sitemap Generator,BuddyPress Forums Extras – Forums Index

    Any ideas much appreciated. Thx.

  14. Thomas says:

    I have following problems to get the plugin work in MS Internet Explorer 8.0:
    Files ar uploaded but they don’t show up in the forum
    It works fine in e.g. Firefox. Any idea?

  15. Marcus says:

    Hi there.

    We seemt o be having a strange problem with this plugin.

    The users can not upload PDF
    Error message:
    [pdf] [denied mime] Asian_Threat_Forecast_2010.pdf (48 KB)

    The size limit is 500K and if I up0load this as an admin, I have no problem at all.

    BuddyPress
    Version 1.2.5.2

    Forum Attachments for BuddyPress
    Version 0.2.3

    WP 3.0.1

    Any help with this issue?

    Thank you.

  16. Ralf says:

    Hi Boone, next to the image thumbnails not showing up, I now have another problem. I changed my theme to “Custom Community”, but now only the administrator can upload pics and files. All other members can’t and they don’t even see the upload form. Looking forward hearing from you.

    Thanks

  17. Josh Jenkins says:

    Boone – as a lurker in the BP community, just wanted to let you know that you’re awesome.

    Also, I’m having the same issue as Ralf. The attachments forms only appear when I’m logged in as admin, not for other users. Thanks so much if you’re able to help at all.

    Best,
    Josh

  18. zenfred says:

    On my site it works for the admin but not for members. Any clue? Thx.

  19. Boone Gorges says:

    Nigel – The error messages you’re reporting suggest that the culprit is the Forum Notification plugin you’re using. That plugin is somewhat old and might be what’s causing the problem; consider updating to http://wordpress.org/extend/plugins/buddypress-group-email-subscription/

    Thomas – I’m not sure. Is javascript turned off in IE?

    Marcus – Check out the size limits listed near the beginning of forum-attachments-for-buddypress-bp-functions.php. Make sure that you set your max very high for all of the available options.

    Ralf, Josh, and zenfred – This problem should be fixed with version 0.2.4 of the plugin. If not, see http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/forum-attachments-for-buddypress-only-admins-can-attach-docs/#post-78073

  20. Ralf says:

    Thanks Boone, the upgrade indeed fixed that. The only thing which is not working is the thumbs…

  21. EVKAKIJ says:

    Hello mister. What should I do, when I attach image in IE browser, it dont appear there? In Firefox it works fine. I use WP 3.0.1

  22. thomas says:

    @boone. js is enabled in internet explorer

  23. Bojan says:

    Hi Boone

    We also have the problem with Internet Explorer. JS is enabled…
    Any hints!?

    Thanks

  24. idea13 says:

    Hi – I tried to follow the install intructions but can’t get this to work on my site: http://idea13.org

    The BB-Attachment folder on the server is write enabled, it has created a subfolder called ’0′. Images from my test uploads have been saved there.

    in EXPLORER:
    I get a red message:
    There was an error when creating the topic

    in GOOGLE CROME and MOZILLA:
    It seems to upload OK to the post:
    http://idea13.org/groups/idea13-faq//forum/topic/test-6/

    But when I click on it, I get a blank page:
    http://idea13.org/wp-content/plugins/forum-attachments-for-buddypress/download.php?filenum=9

    PLease let me know if there is some easy solution to this?
    MANY THANKS in ADVANCE!!!
    Best
    Michaela

  25. idea13 says:

    PS: forgot to add that I’ve got the latest version – Version 0.2.4
    Cheers
    M

  26. ericdano says:

    The inline images attached to a forum post don’t show up, I just get a broken image icon.

    Ideas? Other than that it seems to work

  27. Alan says:

    I really have to let you know, I have installed this plugin of version 0.2.4 twice, but also only admin can upload. As you say in two topics here and buddypress forum, ['role']['upload']=”read”, or add “add_action…”, I try all, but it doesn’t work for users to upload files.

  28. Alan says:

    Sorry, now I set users as subscriber and it works! But as you know, in WP MU setting everyone is subsriber. Do I need to set for every user? Thank you!

  29. Javier says:

    Hi
    I installed this plugin in a share hosting where the dir structure was:
    /home/myaccount/www/domain/wp-load with the bb-attachement directory in /home/myaccount/www

    The plugin works perfectly.

    However I moved the site to a new directory structure:
    /home/myaccount/www/wp-load with the bb-attachement directory in /home/myaccount/

    Now the inline images attached to a forum post don’t show up

    Any idea what could be happening?. I tried all the fixes that people is suggesting in comments but I cannot find the problem

    Aparently wp-load path is correct

    Thanks in advance
    Regards
    Javier

  30. Sherry says:

    Hello;

    I need a little help, please. :) My server path doesn’t seem typical, additionally, server paths and things blog my mind a little bit. So I’m hung up on something.

    I tried hard coding my server path as described above, but it’s still not working. I installed a pathinfo.php script on my server, and it says my absolute path is /data/16/1/4/49/1819375/user/1972104/htdocs/bb-attachments

    But when I hard code that, replacing ‘path’, it’s still giving me the “upload failed” with the missing image icon.

    I’m sure I’m pretty close to solving this, if you can just help me with the final details.

    Thanks a lot!

    Sherry

  31. Erik says:

    Hi,

    Great plugin. I use BuddyPress and install this plugin. The upload works fine but the images in the forum thread looks very big? Is it possible to adjust the max size of the images in the forums?

    Thanks,
    Erik

    • Boone Gorges says:

      I guess I would try doing it with css. max-width: 400px; or something like that.

  32. Sonya says:

    Hi Boon,
    I’ve installed this plugin 3 times. It was working the very first time I installed it, but I upgraded something and it blew up. I’ve deleted and reinstalled the plugin again, but nothing gets uploaded. The post appears, but without a picture.

    I went to check the database, and there is no table for bb_attachments. Can you please tell me how to recreate them?

    The folder in the /home location is being created, but no files are being saved. Thanks!

  33. Sonya says:

    Hi Boon, sorry about the message earlier. I realized I was looking at the wrong database. The tables are there, but the images aren’t being saved and new rows aren’t being created. Would you be able to help take a look? I can pay you for your time.
    Thanks! Sonya

    • Boone Gorges says:

      Sonya – You can email me if you want and we can talk about it. boonebgorges at gmail

  34. Ryan Holden says:

    I was getting blank images when using you plugin..

    File: /wp-content/plugins/forum-attachments-for-buddypress/image.php?filenum={w/e id}

    ^was returning nothing. On investigation php variable $filenum was being set to null after /wp-load.php was loaded.

    Changed Line 2 of image.php to:
    $bp_attach_filenum = $_GET['filenum'];

    and Line 9 to:
    $file = $wpdb->get_results(“SELECT * FROM “.$bb_attachments['db'].” WHERE id = $bp_attach_filenum AND status = 0 LIMIT 1″);

    And everything started moving again!
    This is probably due to the new WP 3.1 update, running BP v1.2.5.2 and your plugin v0.2.4

    Thanks For the plugin!

    • Boone Gorges says:

      Ryan – Cool, thanks for the tip! I’ll investigate to see if I can find the root of the problem. Your fix sounds good though.

  35. Thomas says:

    I get the same problem as Marcus (http://teleogistic.net/code/buddypress/forum-attachments-for-buddypress/#comment-15801) with en error message:
    (doc) denied mime (filename) (50k)

    This occurs only for specific users and I cannot reproduce the error in my environment, with similar user rights, filetypes, file size, …

    Does anybody have an idea?

  36. Thomas says:

    I cannot upload ppt although right mime type is enabled:
    $bb_attachments['allowed']['mime_types']['administrate']=array(‘ ….. ‘application/vnd.ms-powerpoint’, ‘application/vnd.openxmlformats-officedocument.presentationml.presentation’ ……);

  37. Thomas says:

    … pptx works fine.

    • Boone Gorges says:

      Thomas: I recently started having some problems with new Office files. It ended up being that the server was interpreting them as zip files, which aren’t on the default whitelist for regular user uploads. I ended up fixing it like this. Change the line around 493, which checks the $mime agains the allowed mime_types, to the following:

      if ( $status==0 && !in_array( $mime, bb_attachments_lookup( $bb_attachments['allowed']['mime_types'] ) ) ) {
      // Exception for Office XML files. Crummy solution
      $office_exts = array( 'docx', 'xlsx', 'pptx' );
      if ( !in_array( $ext, $office_exts ) )
      $status=4;
      }

      As I say in my comment there, it’s not a great solution, but it works for me.

      That might not solve your ppt problem (seems like the opposite issue) but it’s worth a try I guess.

  38. Thomas says:

    Thanks Boone, but it didn’t help. It’s really strange. All the mime types and extensions work for Office 2007 files and old *.doc and *.xls files but not *.ppt.

  39. Thomas says:

    Boone: I solved the problem with PPT files by replacing th mime-check in forum-attachments-for-buddypress-bp-functions.php around li 493 with following code:

    if ( $status==0 && !in_array( $mime, bb_attachments_lookup( $bb_attachments['allowed']['mime_types'] ) ) ) {
    // Exception for PPT files. Crummy solution
    $office_exts = array( ‘ppt’ );
    if ( !in_array( $ext, $office_exts ) )
    $status=4;
    }

    Not very nice but it works!

    • Boone Gorges says:

      Hi Thomas – Yes, that is an ugly solution – but if it works, it works! Nice job.

  40. Thomas says:

    The Attach file form shows above the POST TOPIC button in new threads but below the POST REPLY button in ongoing threads. This confuses users and some of them miss to attach files before they press the reply button. How can I move the Attach file form above the POST REPLY button?

  41. David says:

    Hello Boone, thanks for all your work with this plug in. I have not been able to get it functioning and have followed several solutions you have posted with out any luck. Any help would be greatly appreciated.

    The problem I am having is, a white page when the image is downloaded, also the images do not display. I can see in the html code that the link and the image are there but the src file is not working.

    Here is what I know so far.
    I tried changing the path many different ways to no avail. I finally tried the bit of code you wrote to print out all the characters if it was the correct path. That worked it turns out the correct path is /../../../wp-load.php

    The bb-attachments file is in the root of the website next to html. WP is installed in html.

    Within the bb-attachments file, the images seem to be uploaded correctly. The structure looks like this bb-attachments/0/image.jpg

    Within the database the images are listed by file numbers and image.jpg name.

    I am hosted by mediatemple and it is a shared server.

    I have been spinning my wheels trying this for two days and I am determined to get this working.

    Thanks again in advance for any help.

    • David Ball says:

      Found my way back here 7 months later looking for a solution. I still have not found one and would still have some hope that It will work. Boone could you please look at this!

      • Boone Gorges says:

        David – Sorry you’re continuing to have problems. There’s not much I can do on my end. Either there is a path error (which you said you’ve been experimenting with) or there is a PHP level error, which you could only find by putting some debug statements into the download.php file.

  42. Mark Duffy says:

    Hi Boone,

    I have found a bug. When I create a new post, the file upload works ok. But when i edit that post, and try to upload a file it doesnt work. Im running php 5.3 on Windows Server with IIS.

    Mark

  43. AstroLander says:

    Yeah, I can confirm what Mark Duffy says. The plugin works fine when you create a forum post, but say you want to put an image(s) in the reply to said post. You can’t, it only shows the text of the msg, but no images.

  44. Athalas says:

    We are hosting a site where users can upload photos to enter a competition (http://www.momtomom.co.za/groups/naartjie-baby-competition/forum/) allot of IE users are having issue attaching images, for example: http://www.momtomom.co.za/groups/naartjie-baby-competition/forum/ The users have reported that did not receive any error.

    also is it possible to have the images display on the groups page in its activity feed? (http://www.momtomom.co.za/groups/naartjie-baby-competition/home/)

    Any support would be appreciated.

    WordPress 3.1.3
    BuddyPress 1.2.8

  45. Thomas says:

    Athalas
    I hade the same problem and solved it by reading the installation instructions carefully :)
    See the last bullet point in INSTALLATION here: http://buddypress.org/community/groups/forum-attachments-for-buddypress/home/

  46. Athalas says:

    Thanks for the reply Thomas.

    I however followed the installation instructions before posting, it didn’t resolve our user issues.

  47. Thomas says:

    OK, sorry, I did not but it helped :)

  48. Becky says:

    Boone,

    Your plugin has been working fine for me for over a year (great plugin!). However, i have just changed server and upgraded to WP3.2.1 and BP 1.2.9. Everything still upload fine and download fine but I keep getting this error when the forum post containing attachments is viewed:

    PHP Warning: Cannot modify header information – headers already sent in /var/www/abc/wp-content/plugins/forum-attachments-for-buddypress/image.php on line 69

    I checked the line, it seems to be relating to mime type, so i am not sure what is the issue.

    I ahve also increased the upload size to 1000*1024 (which i presume means 1MB per attachment).

    Would appreciate if you could give me some guidance to do more troubleshooting (if required). I am also using the most current group email subscription plugin.

  49. This plugin didn’t worked for me :(

  50. Problem with user role

    The plugin only works correct if I assign to all user the role “Superadmin”. With any other user status they either don’t even see the upload form or the uploaded file is not downloadable.

    Do you have any idea how to change the settings so that any ordinary user can upload files to the forum?

    We are using WP 3.1.2 and BP 1.2.8.

Pingbacks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>