Hi,
here's the patch to add support for webfm for comments. The other patches that I sent in the last days are all just preparatory work ;-) I'm setting up a forum and need the possibility to attach files to every post, original and comment. The comment_upload module is not really working well for 6.x yet, and I also prefer to have the same mechanism (webfm) for nodes and comments...
Please note:
The patch changes the database. Since comments have their own id system independent from nodes, we need another colum "cid" (comment id) in webfm_attach table. Thus a row will look like <nid,fid,weight,cid> and cid is part of the primary key. "nid" is 0 for a comment entry and "cid" is 0 for a node entry.
When you apply the patch, you must run update.php to update the table and existing entries.
The patch depends on other patches: Before you apply the patch, you must also apply the preview patch (http://drupal.org/node/249786) and the "Remove file refs for a deleted node" patch (http://drupal.org/node/282328) because the comments patch relies on their functionality.
The patch is not very complicated, just some case distinctions whenever there is an explicit reference to a node object or the node edit form etc. More or less, we just need to implement the comment_hook as webfm_comment and extend most of the database functions by a "selector" argument telling if we want to handle a node or a comment.
Permissions for viewing attachments or accessing webfm are always inherited from the comments parent node. One could add a specific permission setting to allow or disallow webfm for comments, but at the moment I just consider the nodes setting.
Please test :-)
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | webfm.comments_v3.patch | 15.27 KB | Frank Steiner |
| #1 | webfm.comments_v2.patch | 15.29 KB | Frank Steiner |
| webfm.comments.patch | 15.56 KB | Frank Steiner |
Comments
Comment #1
Anonymous (not verified) commentedI missed that the comment module itself is already settings a
$comment->previewflag, so I don't have to do that (and I couldn't do it that way anyway :-)). A little bit of superflous code removed.Comment #2
Frank Steiner commentedCome on, folks, nobody interested in testing this? Nobody longing for webfm attachments in comments in a forum?
Comment #3
Frank Steiner commentedAdjusted for version for 2.10-rc2.
Comment #4
robmilne commentedI didn't want to complicate the first (second in my case since I tagged the wrong branch) RC with db schema changes.
I've applied this patch to one of my test servers and indeed it seems to be working - thanks again Frank. I'll test more before I commit to RC3.
Comment #5
robmilne commentedComment #6
Frank Steiner commentedYes, I didn't mean to nag you with this :-) I just had to update this for my own installation anyway because we are already running a forum which relies on webfm.
Comment #7
nhck commentedThis must have gotten in a while ago. Reopen if you don't think you.
Frank Steiner, again thanks for helping and making webfm better.