Enable uploading of sav files
From a member using the Commons for a grad class:
I notice that the Commons Upload to Library Program will not accept .sav files. These are SPSS datasets that are used frequently in research methods courses and would be helpful to have on course websites. Any chance of lifting this restriction or is there some other way around it?
I believe this is something we can enable from the dashboard, and I'd like to do it quickly as possible. Boone, can you let me know whether you have any concerns? If so, we can wait until after CBOX to discuss. If not, please let me know and Dom or I can make the change.
#3 Updated by Matt Gold almost 9 years ago
- Status changed from Resolved to Assigned
- Assignee changed from Matt Gold to Boone Gorges
Hmmm. That didn't seem to work -- even after making the change described above to Network Settings, I can't add a .sav file to a blog (or a group, for that matter, though I don't know whether BuddyPress has a separate area for allowed file types).
N.B. The file that I tried to upload was a .png file that I changed to a .sav just by changing the extension. Here are the errors I received:
Blog media uploader:
“Screen Shot 2012-10-18 at 1.20.01 AM.sav” has failed to upload due to an error
Sorry, this file type is not permitted for security reasons.
The type of file submitted is not allowed
#5 Updated by Dominic Giglio almost 9 years ago
Sorry I've been silent for so long, I'm swamped with midterms. I can see where Matt updated the upload settings and added "sav" to the list. I've looked all over the dashboard (both Network and Commons) but I'm not seeing any other settings related to Files in Groups. Is this a feature provided natively by BP or are we running a plugin to provide "Files" group support?
#7 Updated by Matt Gold almost 9 years ago
. . . . but I thought we could do both just to be safe.
Boone, I remember that a while ago, when we wanted to allow people with certain email domains to register, you had to create a second field within the dashboard to do it. Don't know whether we're running into a similar problem here, where the standard network admin protocol isn't working for some reason . ..
#10 Updated by Dominic Giglio almost 9 years ago
It appears we may need to add some custom code to the next release to make this work:
#13 Updated by Boone Gorges almost 9 years ago
- Status changed from Assigned to Resolved
- Target version changed from Not tracked to 1.4.8
Thanks for the link, Matt.
In https://github.com/castiron/cac/commit/fccb195bd6b7c8b9c8c4ea3e1591e4fc63e5c679 I defined the 'sav' mime type to WP. Appears to fix the problem on my local. Will test after release.
#14 Updated by Matt Gold almost 9 years ago
Please find a .sav file from the member attached. And I can confirm that he was trying to add this to a blog, though I'd hope that could enable .sav file uploads in both groups and blogs. Just for my own understanding, does BP group files build off of the main allowed uploads list or are allowed file types defined separately?
#16 Updated by Dominic Giglio almost 9 years ago
I've verified in my local dev that your addition from comment 13 does indeed enable the uploading of sav files through the WP media uploader.
However, it does not carry over to group docs, I get an error when I try to upload the attached sav file. So I started looking through the buddypress-group-documents plugin and found two places that define and check the allowed file types:
On line 175 of the main plugin file (index.php), in
bp_group_documents_check_installed() the default file types are added to the DB.
On line 525 of index.php,
bp_group_documents_check_ext() validates the extension of the uploaded file.
Admin.php also checks and updates the DB with new allowed types. But the problem I'm having locally is that I CANNOT find the BP Group Docs admin page anywhere. I've looked all over my local env and on the production site (both network and non-network). Where the heck are these admin settings rendered?! :-)
#17 Updated by Boone Gorges almost 9 years ago
Where the heck are these admin settings rendered?! :-)
Heh, they're not. Their menu is not hooked correctly. The whole plugin is pretty old and shoddy, so we can't exactly fix it the right way, but what we can do is change the 'admin_menu' hook to 'network_admin_menu', around line 184 of buddypress-group-documents/index.php (and wherever else in the plugin 'admin_menu' is used). That should at least make it so that the "Group Files" menu appears under BuddyPress in Network Admin.
#18 Updated by Dominic Giglio almost 9 years ago
OK, I get to work on that now.
Just so I know, does this plugin only exist inside our repo? The link in the header comments to the WP plugin repo says the plugin can't be found. I'm really just wondering if there is a separate repo somewhere that I should be keeping up-to-date with the changes I'm making in our repo.
#21 Updated by Dominic Giglio almost 9 years ago
I have a feeling that this update might cause a lot of extra work for me, but I'm wondering if we should put this issue on hold and attach it to a new issue where we can discuss rewriting the buddypress-group-documents plugin? It seems to me that the functionality it provides is pretty important in the grand scheme of our site. If it's abandoned and in need of updating, maybe I should start working on it?
It could be refactored out into a buddypress-files plugin similar to buddypress-docs (and by similar I mean a similar naming convention, not similar functionality). The current name itself is kinda confusing. I'm also wondering if there's some naming conflicts between bp-docs and group-docs due to the use of the word "Documents" in both plugins? If you think this is a little too much for me to take on right now let me know. So far Featured Content is the biggest plugin job I've worked on. Looking through the files for group-docs I can see that it would be no small job to produce a new version. But it would be really great practice for me to get better with the intricacies of actions and filters. :-)
#22 Updated by Boone Gorges almost 9 years ago
- Assignee changed from Dominic Giglio to Boone Gorges
Dom - Yes, the code is a mess, and yes, we should rewrite it. This is something that I would like to pursue, and have discussed before with Matt and with Ray. But I would like to do it in the context of a larger rethinking of how file uploads are handled within BuddyPress. This is something Ray's already started working on.
The issue discussed in this ticket is pretty small, and there's no reason not to fix it now. I'm going to switch this back to myself, because I've worked with this part of the codebase before, so it'll probably just take me a couple minutes to fix. After cbox we can fire up a larger group discussion about where to go with this plugin.
#24 Updated by Boone Gorges almost 9 years ago
- Status changed from Assigned to Resolved
In https://github.com/castiron/cac/commit/5500b7446077303a5481a09fdc6ab084a3e8efe2 I made the mods necessary to see and alter BPGD settings. I'll make the change and test after release https://github.com/castiron/cac/wiki/Release-ACTION_REQUIRED-list
#25 Updated by Dominic Giglio almost 9 years ago
I know you're busy with CBox and tonight's release, but I'm just curious about one thing. The change you made in admin.php:
<form action="<?php echo network_admin_url() . '/admin.php?page=bp-group-documents-settings' ?>"
Do you think this is why I was getting the "You do not have sufficient permissions to access this page." error? All I changed in my local env was the references to 'admin_menu'. So the settings pages showed up but I couldn't save any new settings. I really just wanna try and remember this if (when) I see that error again.
#26 Updated by Boone Gorges almost 9 years ago
Do you think this is why I was getting the "You do not have sufficient permissions to access this page." error
Yes. The form action was previously pointing to a WP dashboard page that did not exist, and the "You do not have sufficient..." error is WP's generic error message for this kind of situation.