Forum Attachments for BuddyPress: only admins can attach docs
-
I am using @boonebgorges plugin “Forum Attachments for BuddyPress”, which has been working fine for over 6 months now. I am not sure what happened, but all of a sudden only admins can add attachments to posts. Maybe it is something really simple, but I just can’t figure out what’s going on. Any ideas would be greatly appreciated. (WP 3.0.0, PB 1.2.6)
Thanks
-
I ran into the same problem and have gone through the functions’ roles to find an answer. Unfortunately, I don’t have a solution.
forum-attachments-for-buddypress-bp-functions.php
lines 46-51.
`global $bb_attachments, $bp;
$bb_attachments=”read”; // minimum role to see list of attachments = read/participate/moderate/administrate
$bb_attachments=”read”; // minimum role to view inline reduced images = read/participate/moderate/administrate
$bb_attachments=”read”; // minimum role to download original = read/participate/moderate/administrate
$bb_attachments=”participate”; // minimum role to upload = participate/moderate/administrate (times out with post edit time)
$bb_attachments=”moderate”; // minimum role to delete = read/participate/moderate/administrate`Obviously do not want to give upload moderate or administrate to everyone …
Next, the plugin Members was installed, edited “Subscribers” to have upload_files capability and still no joy.
Actually, you should try setting them all to ‘read’. It’ll still be limited to logged in users in virtue of the fact that BP itself only allows members to post in forums.
I’m not near a computer at the moment, but I’ll try to figure it the problem as soon as I can.
Yep – tried `read` instead of `participate` but that didn’t work.
Sorry – didn’t see your reply https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/bb_attachments-roles-for-uploading/
We should close that other thread. I’ll have to study `groups_is_user_mod()` rather than `bb_current_user_can()`
Thanks for your replies so far. I too had set $bb_attachments =”read”, which had worked until recently. Changing it to “participate” hasn’t fixed the issue either, despite the fact that logged in users have the participate role turned on.
Can I get a bit of clarification on what “can’t” means in “users can’t upload”? Does it mean that the upload field isn’t showing up at all for non-admins? Or does it mean that they get an error when they do try uploading?
If it’s the former, try pasting the following lines into the very beginning of forum-attachments-for-buddypress-bp-functions.php, right after `<?php`:
`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’);`Non-admins are not shown the upload fields. Adding the actions and will let you know.
Update: Yes. That worked. Thank you.
Awesome, good to know – I’ll have a more proper fix for the plugin sometime soon, but this will definitely work as a stopgap.
Hey Boone – you are such a genius! Thank you so much for your quick response and fix. My users will thank you! And thank you @LPH2005 too, for your input, which was very useful as it exactly reflected my issue.
Yes! Boone you are indeed a genius. Thanks for the fix, as I was having a similar problem.
I use the plugin with WP3.0.1. and BP 1.2.6. It works fine with e.g. Google Chrome but in Internet Explrer 8.0 files are not uploaded.
Any idea?yep doesnt work with internet explorer ‘
In IE are you seeing the fields where you attach the files? Can you describe the problem in more detail?
yes i do see the fields with ie they just dont work, put file and nothing happens, no thumbnails, no files, no links, while same file with chrome or firefox uploads fine to the post
any fix on this?
It almost certainly means that the JS that replaces the form enctype isn’t working. See the last step in the readme installation for what should be a fix.
Thanks Boone, that worked!
@boone discovered a problem with the plugin. Was unable to attach files to replies to an existing topic, despite seeing the form. Attachments only worked on the first post of new topics.
Dug around a bit, it seems that your JS-based enctype fix was not being loaded on single group forum topic views. When I updated the code to make sure the script was running on those pages, the plugin worked once again.
So, if anyone else is having this problem, check to see if the scripts.js file is loaded into the page and running properly. Hopefully this will save you several hours of searching through code and checking network transmissions.
Thanks for writing a great plugin, Boone Gorges. Hopefully this can be patched in future versions.
PS this is in regards to Forum Attachments Version 0.2.4 running on BuddyPress Version 1.5.1
- The topic ‘Forum Attachments for BuddyPress: only admins can attach docs’ is closed to new replies.