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: _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.


  • Upload to plugin directory and activate
  • If you’d like to change the default settings (as described in step 5 here, 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 [code language=”html”]
    [/code] to [code language=”html”]

  • 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 [downloadstat url=”” get=”total” autop=”false”] times. Are you using this plugin? Consider a donation.

Translation credits

  • Russian – slaFFik

Version history

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

168 thoughts on “Forum Attachments for BuddyPress

  1. Pingback: Teleogistic / New version of Forum Attachments for BuddyPress

  2. Joshua Parker

    Hello Boone. I’ve tried this new plugin, but this plugin gives me issues. The issue I get is when it is activated, when a user clicks on their “Settings” it redirects them to the frontpage. I am not sure if it is Buddypress or the theme I am using.

  3. Boone Gorges Post author

    Joshua – what theme are you using? bp-default, or a custom theme? Someone on the forums reported that they were having similar troubles with modemlooper’s BP widgetized theme.

    Also, what version of BP are you running?

  4. Boone Gorges Post author

    Joshua – Is it possible for you to switch over to bp-default for a second, just to test whether it’s theme related? And if it is, would you mind emailing me a copy of the theme so I can test on my local machine?

  5. Joshua Parker

    I am using the Forum Extras plugin but seeing you had no issue, it may be a combination of other plugins interfering. I will try your suggestion and see what I come up with.

  6. caming

    hi boone,

    first of all, thanks for keeping this plugin alive. it’s exactly what i need for at least one of my site’s groups. only problem is, the result is always a ‘broken’ image.

    i’m wondering if it has to do w/ the bb-attachments directory that must be created. my wordpress is installed at the actual root, so i’m at a loss with where to place the bb-attachments directory (it currently resides at the root w/ the wordpress files)

    i also installed it using the wp auto installer, if that affects anything …

    1. Boone Gorges Post author

      caming – Yeah, the problem is almost certainly the location of the bb-attachments folder. If you’re on shared hosting, it’s very likely that you do not in fact have WP installed in the root, but only that you can’t see anything under the root. You can reconfigure the plugin to make it recognize a different location for bb-attachments by changing the path on line 99, which reads
      If you have your bb-attachments folder in the web root, change it to

      The unfortunate part about this is that your attachments folder will then be a bit less secure than it otherwise would have been, because it will be accessible directly from the web. But it’s probably better than not working at all!

  7. caming

    oddly, the problem wasn’t corrected. i might have narrowed it down a bit, though.

    when posting via the group, a post will go through fine, just without the attached image (the broken image is displayed).

    when posting via the forums page, the following is displayed:

    Warning: Variable passed to each() is not an array or object in /hermes/web09c/b2957/moo.caming/wp-content/plugins/forum-attachments-for-buddypress/forum-attachments-for-buddypress-bp-functions.php on line 461

    Warning: Cannot modify header information – headers already sent by (output started at /hermes/web09c/b2957/moo.caming/wp-content/plugins/forum-attachments-for-buddypress/forum-attachments-for-buddypress-bp-functions.php:461) in /hermes/web09c/b2957/moo.caming/wp-includes/pluggable.php on line 868

    hmmm …

  8. caming

    also, that error image is displayed WITH OR WITHOUT an attempt at attaching an image (i’m using a basic .jpg)

  9. caming

    *i meant to write the ‘error’ is displayed with or without the attempt at attaching an image.

  10. Boone Gorges Post author

    Hi caming – Thanks for the detailed error reports. I think there are several things happening with your installation. The first is that I hadn’t adapted the plugin to account for the New Forum Topic section on the forum index page. I’ve made that change in the repository (tagged version 0.2.3) – try it out and see if it fixes that particular problem.

    As for the problem of images not appearing, I am less sure what’s going on. A few things to check. (a) Are the files getting written to your bb-attachments folder? (b) Are new rows being written to the bb_attachments table in your WP database? If (a) is the problem, then it’s still an issue with your upload directory – either the permissions are wrong, or the path in the plugin file isn’t correct. If (b) is the problem, then there could be a misplaced hook somewhere.

    Since you’re seeing the missing image message, my money is on (a) being the problem – otherwise you wouldn’t see anything at all. Let me know what you find and I’ll try to help troubleshoot further.

  11. caming

    hi boone, thanks for your patience

    rows are being written. permissions are correct on the folder (folder is empty). and the folder location in the functions file is set to:

    and that folder is sitting in the doc root (ie.

    plugins folder is wp-content/plugins/

    i have no other image upload issues across the site, this appears to be the only one. just simply odddd.

  12. 3dp

    I’m haviong a problem with the installation: The plugin is installed and it appears to work, except it doesn’t. I get a broken image with a “[failed] Document.pdf (60.8 KB)”. However, the database shows the document.

    I’ve checked directory permissions and paths…


  13. Boone Gorges Post author

    caming and 3dp – it sounds in both of your cases like the bb-attachments path is wrong. caming, I probably told you the wrong thing – $bb_attachments[‘path’] has to be relative to the server root, NOT the web root. Try hard coding the server path into that variable (/var/www/bb-attachments or whatever) and see what happens. Or you can try = $_SERVER[“DOCUMENT_ROOT”] . ‘/bb-attachments’ or something along those lines.

    3dp – the same holds for you. Make sure that the path being defined at $bb_attachments[‘path’] points to the directory bb-attachments on your server.

  14. Greg Fielding


    I’m on BP 1.2.3 and my images display whitescreen. The uploaded images to appear in the bb-attachments folder.

    I think I’ve got bb-attachments in the right place. No error messages.

    Thank you!

  15. Boone Gorges Post author

    Greg – What do you mean when you say the images display whitescreen? Do you get a WSOD when you upload them? Or when you attempt to view the image in another window, it’s just a white screen? Is data being written to the bb_attachments table?

  16. Boone Gorges Post author

    Great – Do you have access to the database? Can you see whether a bb_attachments table exists, and if so whether there is any data in it?

  17. Greg Fielding

    Yep. The image that I attached is there.

    Partial Texts
    Full Texts
    Show binary contents
    Show BLOB contents
    Hide Browser transformation
    id time post_id user_id user_ip status downloads size ext mime filename
    Edit Delete 1 1269847468 120 45 3232261121 0 0 53943 jpg image/jpeg 0852.jpg

  18. Boone Gorges Post author

    OK, then it’s probably a problem with the path being specified in image.php and download.php. Look for the line that says
    if ( !require_once( dirname(__FILE__) . '/../../../wp-load.php') )

    Replace it with
    if ( !require_once( $_SERVER["DOCUMENT_ROOT"] . '/wp-load.php') )

    and see what happens. If that doesn’t work, replace the path in require_once with an absolute, hard-coded path to the file wp-load.php that should be sitting in the root directory of your WP installation. You can test whether you’re entering the path by putting the following code just after the <?php delimiter at the beginning of the file:

    require_once( [whatever the file path is] );
    global( $wp );
    print( "You should see a bunch of stuff after the colon: ");

    If you see a bunch of stuff after the colon, then wp-load.php is being loaded; if not you’ll have to keep testing until you can pin down the file path.

  19. Boone Gorges Post author

    Yes, except you’ll have to make sure that public_html is really your server path (I’m assuming you’re on shared hosting, which is why you can only see as deep as public_html), and make sure that you have both open and close quotation marks! I would try the $_SERVER[“DOCUMENT_ROOT”] path first.

  20. Greg Fielding

    Actually, I’ve got a dedicated server…and I’ve got my path correct…

    if ( !require_once(‘home/housings/public_html/wp-load.php’) )

    But now I get this error…

    Parse error: syntax error, unexpected T_STRING in /home/housings/public_html/wp-content/plugins/forum-attachments-for-buddypress/download.php on line 9

  21. Boone Gorges Post author

    Hm. For one, make sure that you have a leading slash:
    if ( !require_once('/home/housings/public_html/wp-load.php') )

    The syntax error probably means that there is a syntax error BEFORE the line in question, like a missing parenthesis or semi-colon.

  22. stavrosthewonderchicken

    Very strange! I just moved my XAMPP localhost install to a live server, and forgot to add the bb-attachments folder, but the plugin still worked just fine. Huh.

    Thanks for keeping this one alive, Boone.

  23. Boone Gorges Post author

    Hiya stwc – I believe that the plugin tries to create the bb-attachments folder if it’s not already present. Sweet, huh? Anyways, glad it works! Please let me know if you find problems.

  24. Jeremy

    Hi Boone. I’m trying to get this plugin working… I’m encountering the same problem described above with the addition of one line…
    Warning: Variable passed to each() is not an array or object in /home/mpta/public_html/wp-content/plugins/forum-attachments-for-buddypress/forum-attachments-for-buddypress-bp-functions.php on line 461
    Warning: Cannot modify header information – headers already sent by (output started at /home/mpta/public_html/wp-content/plugins/forum-attachments-for-buddypress/forum-attachments-for-buddypress-bp-functions.php:461) in /home/mpta/public_html/wp-includes/pluggable.php on line 868

    I tried to follow the solutions above, but not sure I did this correctly. On line 99 of forum-attachments-for-buddypress-bp-functions I changed $bb_attachments[‘path’]=dirname($_SERVER[‘DOCUMENT_ROOT’]).”/bb-attachments/”;

    Am I looking in the right place?

  25. Boone Gorges Post author

    Jeremy – I made a little fix to the version of the plugin in the repository (0.2.3) that should address the problem. Either delete your version of the plugin and download the new one, or (since you’ve already done some modifications with your upload path) you could add the following lines
    if ( !is_array( $_FILES['bb_attachments']['name'] ) )
    $_FILES['bb_attachments']['name'] = array();

    Put them right before line 461, which starts “while(list($key…” and call me in the morning πŸ™‚

    Your path looks fine, by the way. I don’t think that’s the problem.

  26. Jeremy

    Hi Boone, thanks for your help and features you make possible for php-challenged bp users like myself.

    I added the lines you posted here. That gets rid of the first part of the error, but I’m still getting this message when I try to post a forum reply with (or without) an attachment:
    Warning: Cannot modify header information – headers already sent by (output started at /home/mpta/public_html/wp-content/plugins/buddypress/bp-groups/bp-groups-templatetags.php:331) in /home/mpta/public_html/wp-includes/pluggable.php on line 868

  27. Jeremy

    Interestingly, if I disable forum-attachments and enable bp-tinymce, I get the same message:
    Warning: Cannot modify header information – headers already sent by (output started at /home/mpta/public_html/wp-content/plugins/buddypress/bp-groups/bp-groups-templatetags.php:331) in /home/mpta/public_html/wp-includes/pluggable.php on line 868

    But if both those plugins are disabled, then everything works fine.

  28. Boone Gorges Post author

    Jeremy – Wow, the bp-tinymce error really throws a wrench in the works. That plugin doesn’t have anything to do with redirects (which is the pluggable.php problem) or bp_group_permalink (which is the bp-groups-templatetags.php problem).

    The problem might have something to do with load order. It might be easiest to experiment with the bp-tinymce plugin, since it’s smaller. Try commenting out the line that says add_action( ‘wp_head’, ‘bp_tinymce_add_js’, 1 ); (by putting two slashes in front of it – ie // add_action( ‘wp_head’, ‘bp_tinymce_add_js’, 1 );). If that makes the error go away, then try playing with the priority. Change the 1 on that line to a 10, then to a 99. See if the plugin still works, and if it makes the error go away. If so then we might be on to something.

    Btw what’s your exact setup? BP/WP versions; other BP plugins? Have you tried disabling other BP plugins to isolate the problem?

  29. Jeremy

    Thanks for your help, Boone. I’m inching closer. After diabling plugins, it seems that the BP Forum Notifcations plugin was creating the conflict. After deactivating it I was able to use BP tinyMCE without a problem. Forum Attachments is still chucking a wobbly though, similar to what Greg was describing above. The link for the file just leads to a blankpage… if I “view source” I get an empty file. Er.

    So, I tried to follow that advice and adjust the path for wp-load.php to no avail. When I try to troubleshoot by adding…

    require_once( $_SERVER["DOCUMENT_ROOT"] . '/wp-load.php')
    global( $wp );
    print( "You should see a bunch of stuff after the colon: ");

    I get the same T String error posted above.

    The image I uploaded is in the database. I can open it via a direct link. I'm running on BP 1.2.3 and WP 2.9.2

    Any thoughts?

  30. Jeremy

    One thought… I did have a previous problem with uploading and posting images (not related to BP). It was solved by going into Settings>Miscellaneous and specifying the upload folder and the full URL path to file.

    Could something be related?

  31. Jeremy

    Sorry for so many posts…

    I changed the path for wp-loads.php to ‘http://myserver/wp-load.php’ Not sure if that’s acceptable or not, but it gave me this error….

    Fatal error: Call to a member function get_results() on a non-object in /home/mpta/public_html/wp-content/plugins/forum-attachments-for-buddypress/download.php on line 10

  32. Boone Gorges Post author

    Jeremy – Sounds like the wp-load file isn’t being referenced correctly. Judging by what you say above, I’m guessing the line should be:
    require_once( '/home/mpta/public_html/wp-load.php');
    It has to be a server path, not a web (http://) path. And make sure you have the semi-colon at the end!

  33. Jeremy

    Ugh. I have no idea what’s going on. Now the files aren’t even being put into the folder. It posts my message to the forum without any error messages, but without any sign of attachment info either.

    Maybe I’ll just give up. Is there any way to tie the Group Documents plug-in into the forums?

  34. Boone Gorges Post author

    Jeremy – Urgh, I’m very sorry that the plugin’s causing you such headaches. I will agree that it needs to be rewritten more or less from scratch to get rid of a lot of this niggling setup.

    To get Group Documents to work right with the forums will probably take a fair bit of coding (though I’m certain it can be done).

  35. Russ

    Ok I got the upload function to work,my ? is can I get it to accept uploads that are bigger then 1024, but I would like it to show at 1024 or smaller. Thanks Russ

  36. Boone Gorges Post author

    Hi Russ,

    At the moment, all the configuration is stored in forum-attachments-for-buddypress-bp-functions.php. Scroll down to around line 61 for the max upload settings.

  37. Ajdin

    WPMU2.9.2 + BP1.2.4.1 + 0.23 this plugin. Upload doesn’t work. DB table created but nothing inserted. Hard code path and set 777 on the folder. No errors displayed. I have problem logging PHP error but I think something should be displayed if there were any.

  38. Ajdin

    I got errors via wp-config (define(‘WP_DEBUG’, true);).

    Notice: Use of undefined constant BB_PLUGIN_DIR – assumed ‘BB_PLUGIN_DIR’ in /var/www/htdocs/sgi-wpmw/wp-content/plugins/forum-attachments-for-buddypress/forum-attachments-for-buddypress-bp-functions.php on line 134

    Notice: Use of undefined constant BB_CORE_PLUGIN_DIR – assumed ‘BB_CORE_PLUGIN_DIR’ in /var/www/htdocs/sgi-wpmw/wp-content/plugins/forum-attachments-for-buddypress/forum-attachments-for-buddypress-bp-functions.php on line 135

    Notice: Trying to get property of non-object in /var/www/htdocs/sgi-wpmw/wp-content/plugins/forum-attachments-for-buddypress/forum-attachments-for-buddypress-bp-functions.php on line 434

    Notice: Undefined index: bb_attachments in /var/www/htdocs/sgi-wpmw/wp-content/plugins/forum-attachments-for-buddypress/forum-attachments-for-buddypress-bp-functions.php on line 465

  39. Boone Gorges Post author

    Ajdin – I don’t think that those errors you’re seeing have anything to do with the plugin not working right.

    Sounds to me like the path set on line 99 is probably pointing to the wrong place. I’m guessing that your bb-attachments directory is at /var/www/htdocs/bb-attachments; if I’m right, you should change that line to
    $bb_attachments['path'] = '/var/www/htdocs/bb-attachments';

  40. Ajdin

    I have alredy set that.
    $bb_attachments[‘path’]=dirname(“/var/www/htdocs/bb-attachments/”); I tried without the end / .
    Any hints on how to debug. I see you commented out include debug.php?

  41. Ajdin

    So far I found that $_FILES[‘bb_attachments’][‘name’] is not array.

    if ( !is_array( $_FILES[‘bb_attachments’][‘name’] ) ) in function bb_attachments_process_post

    I’m looking to see why!

  42. Boone Gorges Post author

    Ajdin – OK, that gives me a hint. Did you change the enctype on the form tag in your templates? The plugin tries to do it automatically with javascript, but in some cases there might be a conflict. See the code in the post above to see what I mean. Check the source of your page to make sure that there’s an explicit enctype.

  43. Boone Gorges Post author

    Yes, the form should have that enctype. Make sure you’re not using curly-quotes around “multipart/form-data”. If $_FILES is empty it means that the html form is not submitting any file information along on form submit, which usually means it’s the wrong enctype, but if you have it correct, then I’m not quite sure what to think.

    Are other parts of your BP installation with file uploads (avatars, for example) working correctly?

  44. Ajdin

    I think this form is part of a template, I’m using default bp template.
    I found a for in buddypress/bp-themes/bp-default/forums/index.php
    and added enctype attrib but it is not showing on screen. Not sure if it is cached or the wrong script?!

  45. Boone Gorges Post author

    Aha. That index.php file creates the form on the Forum Index page (when you click the Forums tab in the main nav). You’ll also need to make the changes in buddypress/bp-themes/bp-default/groups/single/forum/edit.php and topic.php.

    BTW it’s generally a good idea to make the changes in a child theme rather than bp-default, as bp-default will be overwritten when you upgrade BP. Basically that means creating a child theme stylesheet, then copying over the previously mentioned three template files (being sure to reproduce the directory structure) into the new theme directory. See for more details.

  46. Meini

    Hi Boone,
    thanks for the plugin. It works well in Firefox, but nothing won’t upload in IE8, no error message, nothing. The time it takes to post the page with the attachment indicates that there is no upload happening at all.
    Any idea what is happening?

  47. Ajdin

    Check the page source, find <form tag (there should be 2, one for search and the other one for posting topics/reply). See if the second form has "enctype" attribute? If not there, that is the problem. You'll need to add it in your template files!

  48. Meini

    Thanks for getting back to me. I did include the enctype earlier while trying to get it to work w/o js. So, I just checked the IE source and it’s there:

    Hm… any other idea? This is a testing site, if you want to play around, feel free to sign up and have a go…

  49. Meini

    Let me try this line of code again:
    form action=”” method=”post” id=”forum-topic-form” class=”standard-form” enctype=”multipart/form-data”

  50. Ajdin

    I got the upload to work but with fixes in your code

    I have $bb_attachments[‘path’]=dirname(β€œ/var/www/htdocs/bb-attachments/”);
    At the point when temp file is copied to its final destination the $bb_attachments[‘path’] has value β€œ/var/www/htdocs/tmp/”); !?
    In download.php the same variable has value β€œ/var/www/htdocs”

    The only plugins I’m running are buddypress, this one and akismet?!
    Any idea?


  51. Ajdin

    The problem is

    It should be without dirname()


  52. Meini

    Boone, you were right. I made a stupid mistake in my template file. The line enctype=”multipart/form-data” fixed it and it is now working in IE8.

    Thank you!

    1. Boone Gorges Post author

      Hi Leland. A quick and dirty way to block non-admins from uploading is to put a kill statement in the function bb_attachments_upload_form() in forum-attachments-for-buddypress-bp-functions.php. If you only want site/super admins to be able to upload, put the following lines right after global $bb_attachments:
      if ( !is_site_admin() )
      return false;

      Use is_super_admin() instead if you’re running WP 3.0+. If you want to restrict uploads to GROUP admins, you’ll do something similar, using groups_is_user_admin(). Something like this (untested, but it should be close):

      global $bp;
      if ( !groups_is_user_admin( $bp->current_user->id, $bp->groups->current_group->id ) )
      return false;

      Good luck!

  53. Leland

    Boone, How would I go about showing attachments in the activity component feed? I am filtering the feed for 1 particular group (which is an announcement group – admin posting only) and I want to make sure admins can upload files to this group when they post announcements.

    1. Boone Gorges Post author

      Hi Leland, It should be possible to show forum attachments in the activity feed by adding a filter to the output of bp_activity_content and testing against the $bb_attachments global. (Or, better yet, you would write it to the activity item on the way in, using the filter groups_activity_new_forum_post_content.) Now that I think of it, this is a pretty good idea – I might try to implement it in a future version of the plugin.

      Actually attaching things to an activity update is a more complicated procedure. I’m guessing you’d need a more generalized upload plugin in order to make it work. Francesco’s GSOC project – in particular, the media component – might be the start of what you’re looking for.

  54. Ajdin

    Failes to upload xls and ppt with MimeType error (Not allowed MimeType). xlsx and pptx are OK. xls and ppt created with Office 2003. I added to the lisat of allowed mimetypes (default) application/msexcel, application/x-msexcel, application/x-ms-excel, application/, application/x-excel, application/x-dos_ms_excel, application/xls

    Any idea?

    1. Boone Gorges Post author

      Hi Ajdin – Are you able to upload any other kinds of file? Do file uploads in the WP post editor work correctly? (I wonder if it’s a server config issue.)

  55. Joshua Parker

    Good morning, Boone. I recently switched my server from Apache to Nginx. I was using your bb-attachments plugin with amazonaws service with virtual hosting when I was using apache, but since I switched to Nginx, files don’t get uploaded to my CDN anymore. Do you know if there is something that needs to be changed or modified in the code or whether or not I need to add rewrite rules? Thanks for your help.

  56. Boone Gorges Post author

    Hi Joshua – Hrm. I have never tried using Amazon AWS with this plugin, and I am not very familiar with Nginx, so I might not be much help πŸ™‚ I’m guessing that it’s a problem with the rewrite rules, which Nginx would handle differently from Apache, but I’m afraid I don’t know for sure.

  57. Glenn Caleval

    I have a theme issue that has an easy fix for most plugins but I’m too slow to find how to apply it to FAFBP. The sidebar gets pushed to the bottom of the page, even if it is not an image, but a doc file that just shows the file name.
    I’m using Suffusion and the fix is to add a column div before the content div and to close the column div after the close of the content div.

    But FAFBP doesn’t have a an obvious template file that I can find where the edits could be made? Everything works correctly so long as there is no actual attachment uploaded.

    Any suggestions or hints to a good direction would be appreciated.

    BTW, I had a couple of the problems described well above this message and your tip for hard-coding the path solved them perfectly.

  58. hamid

    hello boone i’m using your plugin on my testing wordpress and buddypress delopyed on my computer it works perfectly but when attaching files with 500kb size and up ,it gives me this error message “denied size”, can you advise me what i can do so that i can set to infinite the size of the file which the users can attached.
    Thanks hope for your reply


  59. Dan

    Hi there,

    I have spent a couple of days trying to work this out now and cant.. Whenever I upload an image I get a cross and failed. checked bb-attachments and images not uploading. any suggestions?


  60. Ralf

    @: DAN, check post 13,14 and 15!!

    Hi Boone,

    Having read almost all posts on this forum, I think I know what the problem is, however, some stuff makes me confused.

    Here the direct link to the problem source:

    I installed the plugin, and without doing anything, it seemed to be working fine. It created the folder itself in the root, it places the uploaded pictures there, I can download the pictures BUT, as you can see the thumbs are not working. It displays a broken image file. It would be awesome if the thumbs would work, so I would highly appreciate your help.


  61. chris

    Hi Im using the Suffusion theme and my sidebars are being pushed under the buddypress content when ever I move to a buddypress page on my site.The sidebars then reappear where they should be when I navigate to a non-buddyress page on the same site. Please any ideas? Im not a programmer so Id appreciate a dummies guide if at all possible. Thank you

  62. Boone Gorges Post author

    Glenn and Chris – Try playing with the style elements mentioned in forum-attachments-for-buddypress/style.css. Off the top of my head, I would try changing the h4 to have a certain width (200px, maybe) and try floating it. Use Firebug to see which element is causing your sidebar to pop down.

  63. Boone Gorges Post author

    Hamid – There are configuration options in the first 100 lines or so of forum-attachments-for-buddypress-bp-functions.php. Look in particular around lines 61-66, where max attachments sizes are defined. Adjust them as you’d like.

    Dan – Check to see that a bb-attachments folder is being created in the directory above your WP installation, and that files are being written there. Also, make sure that you have a bb_attachments table in your database.

  64. Glenn Caleval

    Boone, thanks for the tip. I did create a fix, that didn’t involve changing H styles, but I’m embarrassed to admit that I was doing so many code variations that I don’t remember which one actually addressed the FAFBP issue so I can’t immediately offer it up for others.

    At some point I need to back track and document everything for future reference and when I determine what I did I’ll post it here. Undoubtedly tho, others will have better solutions .

  65. Glenn Caleval

    Chris, your first step is to make sure your BP templates know about Suffusion. Have you inserted the ?

    If not you need to add that just before and remember to close the div with after the closing content div.

    You need to do this for templates that create a BP page such as members.php, home.php. Sayontan’s buddy press pack for Suffusion handles all the “standard” ones but if you have plugins that render new pages they have to be done manually.

    If you’ve got that done and sidebars are still being pushed down, it is in the Suffusion css. I did not directly edit any of the FAFBP files to any good effect. But I think I adjusted the CSS for forms.standard (using Suffusion’s Custom CSS feature).

    Sorry, that’s the best I can do for now.

  66. Chris

    thanks for that, Im embarrassed. Was usin gthe standard BP template plug in. Now switched to the Suffusion specific template and it did the trick perfectly. Thank you. Rgds Chris

  67. Minsyan

    Hi there I tried to download the bb-attachments plugin, upload in my folder wp-content–>plugins, but when i went to the plugins at wp admin, and tried to activate it, i keep having this problem…

    Plugin could not be activated because it triggered a fatal error.

    Fatal error: Call to undefined function bb_get_option() in /home/thedonki/public_html/wp-content/plugins/bb-attachments/bb-attachments.php on line 74

    may i know what is wrong as i really hope i can get this thing running smoothly…


  68. Ralf

    Hi Boone, maybe you overlooked my previous question, but I would still highly appreciate your answer to the following question:

    “Having read almost all posts on this forum, I think I know what the problem is, however, some stuff makes me confused.
    Here the direct link to the problem source:
    I installed the plugin, and without doing anything, it seemed to be working fine. It created the folder itself in the root, it places the uploaded pictures there, I can download the pictures BUT, as you can see the thumbs are not working. It displays a broken image file. It would be awesome if the thumbs would work, so thanks in advance.”


  69. Boone Gorges Post author

    Ralf – It’s hard for me to troubleshoot that particular problem. The download.php and image.php files work in much the same way. Check the first few lines of each and make sure that they look alike through about line 18-19. In particular, be certain that the path to wp-load.php (on line 5) is correct in image.php.

  70. Ralf

    These are the first 19 lines of the image.php file:

    get_results(“SELECT * FROM “.$bb_attachments[‘db’].” WHERE id = $filenum AND status = 0 LIMIT 1″);

    if ( !isset( $file[0] ) || !$file[0]->id )

    $file = $file[0];
    $file->filename = stripslashes( $file->filename );
    $path = $bb_attachments[‘path’].floor($file->id/1000).”/”;
    $fullpath = $path . $file->id . “.” . $file->filename;

    if ( !file_exists( $fullpath ) )

    if ( !list( $width, $height, $type ) = getimagesize( $fullpath ) )
    exit(); // not an image?!

    $mime = image_type_to_mime_type($type); // lookup number to full string
    $mime = trim(substr($mime,0,strpos($mime.”;”,”;”))); // trim full string if necessary

    if ($height>$bb_attachments[‘inline’][‘height’] || $width>$bb_attachments[‘inline’][‘width’]) {

    And here the download.php file:

    get_results(“SELECT * FROM “.$bb_attachments[‘db’].” WHERE id = $filenum AND status = 0 LIMIT 1″);

    if ( !isset( $file[0] ) || !$file[0]->id )

    $file = $file[0];
    $file->filename = stripslashes( $file->filename );
    $path = $bb_attachments[‘path’].floor($file->id/1000).”/”;
    $fullpath = $path . $file->id . “.” . $file->filename;

    if ( !file_exists( $fullpath ) )

    @$wpdb->query(“UPDATE “.$bb_attachments[‘db’].” SET downloads=downloads+1 WHERE id = $file->id LIMIT 1″);

    $mime = image_type_to_mime_type($type); // lookup number to full string
    $mime = trim(substr($mime,0,strpos($mime.”;”,”;”))); // trim full string if necessary

    if ($height>$bb_attachments[‘inline’][‘height’] || $width>$bb_attachments[‘inline’][‘width’]) {
    if (!file_exists($fullpath.”.resize”)) {

    In the end a couple lines are not the same. I have no idea how to read that, so thats why i post it all here (sorry if its quite large). Is the problem in here?


  71. Ralf

    The code changed a little bit in the beginning, but still no thumbs.

    This is the entry that is still different in image and download.php.

    @$wpdb->query(“UPDATE “.$bb_attachments[‘db’].” SET downloads=downloads+1 WHERE id = $file->id LIMIT 1″);

    if ( !list( $width, $height, $type ) = getimagesize( $fullpath ) )
    exit(); // not an image?!

    1. Boone Gorges Post author

      Still not really sure what you mean by this code. Is there a line in image.php that says something about wp-load.php? It should be followed by return; After that line, type echo get_bloginfo( 'url' ); die(); and reload the page. You should get the URL of your blog. If not, then your path to wp-load.php is not correct.

  72. Ralf

    I tried that, and the URL is not popping up anywhere. Not in the script nor on the actual page itself (didn’t quite know where to look for it). So I guess is the wp-load.php is incorrect. Is there a way to fix that? thanks

  73. Boone Gorges Post author

    Ralf – Yeah, you’ll have to hardcode it. Replace the ../../ stuff with a path to wp-load.php. What that path is will depend on your server setup. It might be something like ‘/var/www/html/wordpress/wp-load.php’. Or if you’re on shared hosting it might be something like ‘/home/ralf/public_html/wp-load.php’.

  74. Ralf

    Hi Boone, thanks for all your troubles, but I can’t get it to work. I’m most definitely filling in the wrong path to wp-load.php, because I get an error when trying to download the pictures, saying line five (the line of wp-load.php) is incorrect. So I changed it back. Although the broken “thumb” picture is now gone, there are still no thumbs of the pics uploaded. I only see a little clipart pic. I’ll think I’ll just give up…. I so much wish the thumbs would work. Thanks again!

  75. caming

    aaaah, i’m back, boone. after upgrading WP and BP recently, i re-installed your plugin, but rather than confront errors (there are none), the image just doesn’t display … at all. not even the little ‘x’ (which at one point gave me hope).

    i’ve created bp-attachments, permissions at 777. no luck. i’ve even surfed this thread for those with the same problem, but couldn’t find it.

  76. Boone Gorges Post author

    Ralf – Sorry they’re not working. These sorts of things are very difficult to troubleshoot remotely.

    caming – Are the other parts of the plugin showing up? Are you seeing an upload form under the post box? (Maybe the plugin isn’t activated at all.) If they are, then maybe the stuff that’s hooked to bp_get_the_topic_post_content isn’t getting loaded correctly. Do you have another plugin activated that affects forum content?

  77. caming

    Yup, everything else appears fine; it even posts correctly – just without any image showing (also, my directory is empty, so the images are not being post at all). It’s quite the enigma. The only other plugin is ‘BuddyPress Template Pack’

  78. caming

    after browsing the table in mySQL, i’m noticing that the new image upload attempts aren’t in there. just the old images that were uploaded previously …

    should i junk the table and start over?

  79. Ralf

    Hi boone,

    Is there a way that I can give you my login for you to have a look at it? I really need it (the thumbs) to work.


    1. Boone Gorges Post author

      Ralf – I’d need login info for your FTP as well as your wp installation. If you want to send them to me at [my Twitter handle] I will try to find time to look


    Hi Boone,

    Hereby the tip for the future Forum Attachment Plugin. To show the user before opening a topic that the topic has an attachment (pictures for example) it would be useful if the topic title showed a little attachment icon. Even better would be if this icon changed according to the type of attachment. Thanks again for the help!


  81. Dia Ritoch

    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 πŸ™‚


  82. Boone Gorges Post author

    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.


    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


    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.


  85. Boone Gorges Post author

    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.

  86. Ricky

    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?

  87. Nigel

    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!?
    Warning: Invalid argument supplied for foreach() in mydirectory/ on line 42

    Warning: Cannot modify header information – headers already sent by (output started at mydirectory/ in mydirectory/ 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.

  88. Thomas

    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?

  89. Marcus

    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.


    Forum Attachments for BuddyPress
    Version 0.2.3

    WP 3.0.1

    Any help with this issue?

    Thank you.

  90. Ralf

    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.


  91. Josh Jenkins

    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.


  92. Boone Gorges Post author

    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

    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


    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

  94. idea13

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

    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

    It seems to upload OK to the post:

    But when I click on it, I get a blank page:

    PLease let me know if there is some easy solution to this?

  95. ericdano

    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

  96. Alan

    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.

  97. Alan

    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!

  98. Javier

    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

  99. Sherry


    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!


  100. Erik


    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?


  101. Sonya

    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!

  102. Sonya

    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

  103. Ryan Holden

    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!

  104. Thomas

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

    1. Boone Gorges Post author

      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 ) )

      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.

  105. Thomas

    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.

  106. Thomas

    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 ) )

    Not very nice but it works!

  107. Thomas

    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?

  108. David

    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.

    1. David Ball

      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!

      1. Boone Gorges

        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.

  109. Mark Duffy

    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.


  110. AstroLander

    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.

  111. Athalas

    We are hosting a site where users can upload photos to enter a competition ( allot of IE users are having issue attaching images, for example: 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? (

    Any support would be appreciated.

    WordPress 3.1.3
    BuddyPress 1.2.8

  112. Athalas

    Thanks for the reply Thomas.

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

  113. Becky


    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.

  114. Hartfried Schmid

    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.

  115. Jim C

    If you have migrated the site to a new server – don’t forget to edit the database details of the new site in – bbconfig.php.

    In the same location as wpconfig.php.

    This will fix the issue.

  116. Michael

    Works! What would be needed to add a “standby while the upload(s) are processed” ? I just tried uploading a few larger files (increased the size limit) and for an end user they might think it crashed – while in reality the upload process is in progress. Your instructions on doing the patch work was very easy to follow. Thanks!

    1. Boone Gorges Post author

      cameronreilly – It’s likely that it’ll work if you’re using the legacy bbPress forums. But I don’t recommend this. Instead, you should be using the new bbPress plugin, which has multiple attachment plugins available.

Comments are closed.