Fix bb-attachments plugin of bbPress

bbPress as of now doesn’t allow any uploading feature with native support and the famous bb_attachments plugin which was developed for bbPress 0.9 versions doesn’t work with bbPress 1.0+ releases. For those who are new to this plugin, it adds uploading capabilities to your bbPress forum. Users can now upload files from their computer instead of uploading it to file sharing services and then sharing the URL. I have aggregated the information on how it can fixed from the Extends section of the bbPress.org


Here is how you can fix it :

  • Download the 0.2.7 version of the plugin from the Extends section.
  • Upload it to the my-plugins folder under your bbPress root. (Make sure file permissions of my-plugins & my-templates are 755. (How to fix file permissions of my-plugins & my-templates folder)
  • Make a directory /bb-attachments/ above your webroot i.e. just above the folder which is accessible on internet. (This is for security purposes)
  • Set file permissions of the bb-attachments folder to 777. (If you don’t know how to change the file permissions then follow the steps of the link given in step #2)
  • Make sure that bb_attachments table has been created in your database. You can use phpMyAdmin to check. If its not there, you can run this SQL query to create it :
  • CREATE TABLE IF NOT EXISTS bb_attachments (
            id        int(10)        UNSIGNED NOT NULL auto_increment,
            time           int(10)        UNSIGNED NOT NULL default 0,
            post_id     int(10)        UNSIGNED NOT NULL default 0,
            user_id     int(10)        UNSIGNED NOT NULL default 0,
            user_ip     int(10)            UNSIGNED NOT NULL default 0,
            status           tinyint(10) UNSIGNED NOT NULL default 0,
            downloads     int(10)         UNSIGNED NOT NULL default 0,
            size            int(10)         UNSIGNED NOT NULL default 0,
            ext              varchar(255)           NOT NULL default '',
            mime         varchar(255)              NOT NULL default '',
            filename         varchar(255)              NOT NULL default '',
            PRIMARY KEY (id),
            INDEX (post_id)
            ) CHARSET utf8  COLLATE utf8_general_ci;
    
  • Now you need to have correct path in your plugin file. Open it for editing and change this line as per your configuration :
  • $bb_attachments['path']=dirname($_SERVER['DOCUMENT_ROOT'])."/bb-attachments/";
    
  • If you are still having issues (red X signs), then the best bet is that path is not correct. Open http://example.com/bbpress?bb_attachments_debug and look for the value of [path]. You will get an idea if the path you set in the previous step is correct or not (Change the URL accordingly, here it is assumed that it is installed in a sub directory bbpress of example.com).
  • Once you get your path fixed, then the plugin should be working fine.

If you face any issues, then leave a comment here and I will try to help.


Comments

21 responses to “Fix bb-attachments plugin of bbPress”

  1. Shane Pitman Avatar
    Shane Pitman

    I don’t have a problem uploading all files, just .doc and .xls files. The newer .docx and .xlsx files upload just fine and all other file types (.pdf, .jpg, etc.) work without any issue as well. I’ve tried adding every MIME type I could think of, and as I want all of my users to have the same upload permissions, I’ve made the changes at all levels, yet none can upload .doc or .xls.

  2. Got the same problem as Shane. Everything works fine but .doc and xml extensions. I’m trying to find any solutions on the plugin board right now.
    🙁

  3. @Shane @María
    I will take a look at it after our festive season is over here! (1 week)

  4. Hi!

    Thanks a lot for your answer.

    I think I found the problem – the mime type for .doc files was just not spelled correctly for my server, I guess. Tried different options and finally the one that worked fine is ‘application/msword’.

    Have a nice holiday!
    🙂

  5. @María
    Thanks for posting how you fix it. That will surely help someone. 🙂

  6. Shane Pitman Avatar
    Shane Pitman

    Unfortunately, that MIME type is already in the MIME list on my server and in my php file. I still can not attach .doc files.

  7. Hello !

    Done exactly as instructed, it worked fine, database created.

    Path is ok (i m sure cause i harcoded it and tested it)

    Chmod is ok

    When i upload , it creates the right record in the table but do not put the file in the right directory, does not put the file at all as i know.

    Any idea ?

    Thanks,

    Jean (France)

  8. @Shane @Jean
    Try asking on the plugin’s page. I don’t know about the plugin in detail. So, its better to ask CK, the coder of the plugin.

  9. omgitsrfb Avatar
    omgitsrfb

    So easy, Thanks!!!

  10. snable Avatar
    snable

    I hava found the problem and fixed it.My host is GoDaddy and type is windows,so the correct path should be dirname($_SERVER[‘DOCUMENT_ROOT’]).”\\html\\bb-attachments\\”

    1. Good that you fixed it!

  11. Got the attachment plugin working but wanted to know how can one tweak the upload size limit. For example for non-members, members, moderators or the administrator.

    Thanks!

    1. You will have to code to check the user role and according to that set the upload size limit constant. If you are not into coding, then this will be really hard for you.

      1. Hey Ashish,

        Thanks for your reply.

        I was able to edit the plugin file and set different upload limit for members and administrators.

        – Ravin Mohindru

        1. Glad that you figured it out 🙂

    2. That’s a subtle way of tinhnkig about it.

  12. hi!

    🙁 uff

    when I activate the plugin I recive this message:

    Fatal error: Call to undefined function bb_register_activation_hook() in /web/htdocs/www.example.com/wp-content/plugins/bb-attachments/bb-attachments.php on line 97

    🙁

    line 97 is:

    bb_register_activation_hook(str_replace(array(str_replace(“/”,”\\”,BB_PLUGIN_DIR),str_replace(“/”,”\\”,BB_CORE_PLUGIN_DIR)),array(“user#”,”core#”),__FILE__), ‘bb_attachments_install’);

    can someone help me?

    1. Are you using the 1.0.2 version? Tell me more about your bbPress setup!

  13. RoyalManG Avatar
    RoyalManG

    I made all according to procedure, but it does not work. I offer below to upload, but will choose when I will upload a file, the post is only text, not the attachments. I use bbPress version 1.0.2. 🙁 (translate by google translate O:-))

    1. Must have missed something, it works fine.

  14. Srikanth Avatar
    Srikanth

    I am getting error like denied mime for .txt and .doc etc..but i am able to upload images like .jpg..plz give me solution ASAP..

    Thanks in advance…