Please note that this requires the patch at http://drupal.org/node/226853 because _upload_form() hard-codes the "upload files" permission check. However, I've run it past Neil and he said that it qualifies as a bug and will be back-ported. So I figured I'd post this here anyway, although maybe it's best to set postponed.
I had a request from a client to make the permissions more granular on this module, so a user could /only/ upload files to comments, but not necessarily to nodes. Seemed a reasonable request, and also something that might be useful to other people.
Patch forthcoming.
Comments
Comment #1
webchickHere we go.
The one kind of wonky thing I've not been able to figure out is why it's not printing errors when you attempt to upload, for example, a .module file when .module files aren't allowed. Otherwise this seems to be working.
Note that because menu permissions are changed, you'll need to clear your cache to test.
Note also that this permission can now be used to *restrict* comment uploading as well, so it gives additional options there.
Upgrade path written but untested.
Comment #2
webchickOops.
Comment #3
webchickHm.
I had forgotten my hook_form_alter code here, so I've added that back in. However, this still needs work. The form appears, but the upload never quite "takes."
Comment #4
webchickThis appears to be working now, although the fix was not quite as elegant as I would like. I was forced to copy/paste _upload_prepare() to _comment_upload_prepare() just to change the permission check. :( $node is the only thing in scope there, not $form, so I've no way to check $form['#access'] there.
Comment #5
webchickHeine pointed out that the copy/pasted _comment_upload_prepare actually takes $comment as an argument, not $node. Updated patch to reflect this.
Comment #6
webchickAlso, just so I put it somewhere, here's the simpletest I was using to help me debug this. Feel free to use it if this patch ends up being committed (and if not, it should probably still work if you give the user 'upload files' permissions as well). It's not exhaustive by any means, but it covers this feature.
Needs to be renamed to comment_upload.test and placed in a "tests" subdirectory in the comment_upload module directory.
Comment #7
scottrigbyHi,
I wonder if this patch worked (may be my lack of knowledge about patching)
Here's the message I received:
Is this what's supposed to happen?
thanks for any feedback – it would be good to know if I'm doing something horribly wrong (it'll help me to give you better feedback about the patch)
Thanks!
:) Scott
Comment #8
scottrigbyWell, I just got my first error in mailhandler module admin area, after installing this module. Not sure if it's the patch, or module itself, or a coincidence, but... well... if it's helpful at all here's the error
Comment #9
netaustin commentedThis made it into the D6 version, which is the only version currently maintained.
Comment #10
jeno-1 commentedexcuse me. I think I've missed something.
I loaded this module into my Drupal 6, checked all the setting but I can't see its functionality. It suppose let me upload file into comment right? Does it work with FCKeditor?