Project

General

Profile

Actions

Feature #2203

closed

Enable uploading of sav files

Added by Matt Gold over 11 years ago. Updated over 11 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
WordPress (misc)
Target version:
Start date:
2012-10-18
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

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.


Files

p004.sav (5.44 KB) p004.sav Matt Gold, 2012-10-19 04:37 PM
A705SurveySPSS.sav (25.1 KB) A705SurveySPSS.sav Matt Gold, 2012-10-20 10:11 AM
Actions #1

Updated by Boone Gorges over 11 years ago

  • Assignee changed from Boone Gorges to Matt Gold

Fine by me

Actions #2

Updated by Matt Gold over 11 years ago

  • Status changed from Assigned to Resolved
  • Target version set to Not tracked

Thanks. Added this to Network Settings > Upload Settings. If there is anywhere else I need to add this please let me know.

Actions #3

Updated by Matt Gold over 11 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.

Group Files
The type of file submitted is not allowed

Actions #4

Updated by Boone Gorges over 11 years ago

  • Assignee changed from Boone Gorges to Dominic Giglio

Dom, can you take a look at this, please?

Actions #5

Updated by Dominic Giglio over 11 years ago

Boone,

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?

Actions #6

Updated by Matt Gold over 11 years ago

Just FYI, I think that the member is using blogs rather than groups.

Actions #7

Updated by Matt Gold over 11 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 . ..

Actions #8

Updated by Dominic Giglio over 11 years ago

Matt,

What is the "Commons Upload to Library Program?"

Actions #9

Updated by Matt Gold over 11 years ago

I think the member was trying to describe the upload to media library through the dashboard of a blog.

Actions #10

Updated by Dominic Giglio over 11 years ago

It appears we may need to add some custom code to the next release to make this work:

http://www.paulund.co.uk/change-wordpress-upload-mime-types

Actions #11

Updated by Boone Gorges over 11 years ago

Can someone send me an actual .sav file so that I can test properly? (Mime-type spoofing can cause its own problems.)

Actions #12

Updated by Matt Gold over 11 years ago

I can't verify that this is truly a .sav file, but it looks to be. Downloaded from here - http://www.ats.ucla.edu/stat/spss/examples/chp/chpspss_dl.htm

I've also asked the member who brought this up for a sample file.

Actions #13

Updated by Boone Gorges over 11 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.

Actions #14

Updated by Matt Gold over 11 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?

Actions #15

Updated by Boone Gorges over 11 years ago

  • Status changed from Resolved to Assigned
  • Target version changed from 1.4.8 to 1.4.9

Dom, please look into how BP Group Documents handles this.

Actions #16

Updated by Dominic Giglio over 11 years ago

Boone,

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?! :-)

Actions #17

Updated by Boone Gorges over 11 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.

Actions #18

Updated by Dominic Giglio over 11 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.

Actions #19

Updated by Boone Gorges over 11 years ago

The plugin was abandoned and removed from the repo. So no, don't worry about upstream contributions in this case.

Actions #20

Updated by Dominic Giglio over 11 years ago

Understood. Already got the admin page working under BP network settings. Getting a weird "You do not have sufficient permissions to access this page." error when saving new settings, but I'll figure it out.

Actions #21

Updated by Dominic Giglio over 11 years ago

Boone,

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

Actions #22

Updated by Boone Gorges over 11 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.

Actions #23

Updated by Dominic Giglio over 11 years ago

Sorry - missed this update when you switched it back to you.

If you can fix it quickly, I'm all about that. I look forward to discussing a rewrite with you and Ray after CBox release.

Actions #24

Updated by Boone Gorges over 11 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

Actions #25

Updated by Dominic Giglio over 11 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.

Actions #26

Updated by Boone Gorges over 11 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.

Actions #27

Updated by Dominic Giglio over 11 years ago

cool, thanks.

Actions #28

Updated by Matt Gold over 11 years ago

Just going through tickets that piled up while I was offline. Thanks to you both for your work on this.

Actions

Also available in: Atom PDF