[drupal-devel] [feature] Hooks for comment enhancements
Eaton
drupal-devel at drupal.org
Sat Aug 27 00:46:44 UTC 2005
Issue status update for
http://drupal.org/node/28255
Post a follow up:
http://drupal.org/project/comments/add/28255
Project: Drupal
Version: cvs
Component: comment.module
Category: feature requests
Priority: normal
Assigned to: Anonymous
Reported by: Eaton
Updated by: Eaton
Status: patch (code needs review)
Anyone willing to review this for 4.7 inclusion? I have high hopes...
Eaton
Previous comments:
------------------------------------------------------------------------
Fri, 05 Aug 2005 05:24:26 +0000 : Eaton
Attachment: http://drupal.org/files/issues/comment.module_10.patch (2.05 KB)
I've been working on a couple modules that modify and enhance the
commenting system (file attachments in comments, and custom comment
validation for specific nodetypes). Another patch
(http://drupal.org/node/14708) would add limited form and validation
customizatoin, but this one adds nodeapi-style form_pre, form_post,
validate, and view hooks.
It's my first patch offered to the Drupal core, hope it's useful.
------------------------------------------------------------------------
Sat, 13 Aug 2005 13:54:26 +0000 : koorneef
When applied to CVS (2005-08-13):
(lucas at bsd1)/www/koorneef/test.koorneef.net/modules$ patch <
comment.module_10.patch
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: modules/comment.module
|===================================================================
|RCS file: /cvs/drupal/drupal/modules/comment.module,v
|retrieving revision 1.364
|diff -u -r1.364 comment.module
|--- modules/comment.module 1 Aug 2005 05:14:05 -0000 1.364
|+++ modules/comment.module 5 Aug 2005 05:19:14 -0000
--------------------------
Patching file comment.module using Plan A...
Hunk #1 failed at 434.
Hunk #2 failed at 1417.
Hunk #3 failed at 1427.
Hunk #4 failed at 1469.
Hunk #5 succeeded at 1699 with fuzz 2.
4 out of 5 hunks failed--saving rejects to comment.module.rej
done
I'll see if I can update the patch ...
------------------------------------------------------------------------
Sat, 13 Aug 2005 14:34:09 +0000 : koorneef
Attachment: http://drupal.org/files/issues/comment.module_11_0.patch (2.05 KB)
Found the problem: the patch file had DOS format line-endings. Corrected
in new version: 11.
Patch applies, but captcha is not appearing on comment form (it did
with the older patches, see http://drupal.org/node/14708). Have to
investigate further ....
------------------------------------------------------------------------
Sun, 14 Aug 2005 04:48:14 +0000 : Eaton
after some investigation it appears that captcha is expecting a general
'form' $op for the hook, rathre than the 'form_pre' and 'form_post' ops
that this patch supplies.
I added the pre and post operations to mirror the nodeapi form hooks,
I'm not sure that a third general 'form' op would be a good idea. Any
thoughts?
------------------------------------------------------------------------
Tue, 16 Aug 2005 18:14:25 +0000 : moshe weitzman
i think consistency with nodeapi is important, so no 'form' operation
... this patch looks simple and useful to me.
------------------------------------------------------------------------
Tue, 16 Aug 2005 18:24:43 +0000 : arnabdotorg
+1 for consistency; we can (I will) modify captcha to form_post once
this hits core.
------------------------------------------------------------------------
Wed, 17 Aug 2005 12:53:03 +0000 : Eaton
Attachment: http://drupal.org/files/issues/comment.module_14.patch (2.75 KB)
An updated version of the patch with some tweaks. First, the 'form_pre'
and 'form_post' operations have been changed to 'form pre' and 'form
post' to reflect the nodeapi naming conventions.
Second, a 'form param' hook has been added, mirroring nodapi's form
param hook. This allows modules that modify the comment form to
integrate file uploading and other niceties.
------------------------------------------------------------------------
Wed, 17 Aug 2005 12:57:30 +0000 : chx
In the beginning comments were supposed to be simple texts.. If you add
files, how do you display without 'load' and 'view' operations? If you
add 'load' and 'view', then why not create a 'comment' node type?
------------------------------------------------------------------------
Wed, 17 Aug 2005 15:01:22 +0000 : Eaton
Your point is a good one. I'd like to work on a comprehensive comment
node type rewrite, but this was a 'good enough' solution that helped
out existing modules like captcha and doesn't break existing
comment-based solutions.
the comment file-attachment stuff is just a possible use of some of the
hooks; right now it's impossible. in the future a much cleaner solution
would be nice. i've also used the validation hooks in implementing
debate.module and microfiction.module.
------------------------------------------------------------------------
Thu, 18 Aug 2005 14:51:32 +0000 : Eaton
I've checked in a proof of concept module called image_thread that
relies on this patch to provide image uploading in a node's comments.
I'm using it on a small site for photoshop image contests. That module
is rough, but it gives an example of how the new hooks might be used to
provide more complex enhancements.
http://cvs.drupal.org/viewcvs/drupal/contributions/modules/image_thread/
------------------------------------------------------------------------
Sun, 21 Aug 2005 14:46:10 +0000 : chx
Important notice: if this gets in, then project module can be overhauled
to use the comment system!
More information about the drupal-devel
mailing list