Comment module does not support extension of its forms

tangent - December 22, 2004 - 23:20
Project:Drupal
Version:4.7.3
Component:comment.module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

The comment module currently does not support 3rd party modules being able to add form elements or form validation. This is important for the captcha module to be able to add an extra form item.

#1

tangent - December 22, 2004 - 23:22

Here is a patch.

AttachmentSize
comment.form.patch 824 bytes

#2

Anonymous - December 23, 2004 - 11:54

Haven't tested it, but it seems identical to the changes I'd made for my experiments.

+1 for this. This is important to have if people want captchas on comments.

Other modules that I think can benefit by this: Ratings (rate the post along with commenting on it).

#3

moshe weitzman - December 23, 2004 - 12:15

this is a good direction for hook_comment(). for consistency with nodeapi, i propose splitting into 'form pre' and 'form post' operations and also adding a 'view' operation.

#4

tangent - December 23, 2004 - 14:37

I agree with the commentapi thing (however it is named or done) for several reasons. In the short term though, in order to use a captcha module immediately, it wouldn't hurt to update the existing code to support the purpose since I suspect the aforementioned redesign will not happen overnight.

#5

TDobes - December 24, 2004 - 06:48

There's a similar discussion going on in another issue... one of these should be marked as a duplicate.

#6

Stefan Nagtegaal - December 24, 2004 - 11:51

Just not to forget:
If such a patch like this makes it into core it would be nice to strip down the comment.module untill it is a real api.
Removing the comment moderation part into an cmoderation.module would be a good thingtm. This way we make drupal more flexible and light weight...

#7

Stefan Nagtegaal - January 22, 2005 - 09:41

#8

escoles - April 2, 2005 - 13:59

I'm not clear on how to apply this patch. The name of the file is "comment.form", not "comment.module"; is that simply an error? Or should I be able to find a resource somewhere with the filename "comment.form"?

Related question: If I operate on the assumption that the filename should be "comment.module" and try to run patch, I get the error message "Only garbage was found in the patch input." Does anybody know what that would mean?

#9

jotarp@www.jota... - April 4, 2005 - 12:13

Try this.

AttachmentSize
comment.module_7.patch 674 bytes

#10

jgoerzen@change... - April 20, 2005 - 14:19
Version:<none>» 4.6.0

I'm running Drupal 4.6.0 with the attached patch 7. It has been causing me all sorts of weird session troubles. Reversing the patch makes the troubles go away.

Something is really awry here...

#11

varunvnair - June 12, 2005 - 11:49

Is comment.module_7.patch still causing problems, esp with Drupal 4.6.1? Just wanted to know because I wanted to enable captchas for anon users and was thinking of applying this patch.

#12

Hanu - July 18, 2005 - 11:27

This patch works for me and my 4.6.2 installation.

AttachmentSize
comment.module_9.patch 698 bytes

#13

eaton - August 3, 2005 - 23:54

That above patch (v 9) Works for me on 4.6.2 as well. I'm using it in a new custom module to impose length limits on comments, very very useful.

#14

koorneef - August 7, 2005 - 15:08
Version:4.6.0» x.y.z
Status:duplicate» needs review

Attached patch is for CVS (post 4.6.2, dd: 2005-08-07).

Please check the patch for errors. It works on my test site but one never knows ....

AttachmentSize
comment.module_10_0.patch 1.02 KB

#15

moshe weitzman - August 8, 2005 - 03:07
Status:needs review» needs work

it seems that the patch at http://drupal.org/node/28255 is more consistent with nodeapi and more thorough. if someone else agrees, please mark this issue as a dupe of that one.

#16

tangent - October 9, 2005 - 07:52
Status:needs work» duplicate

Marking as dupe of http://drupal.org/node/28255. This issue seems to have been worked around with formapi.

#17

meba - May 3, 2006 - 13:01

Well, this is duplicate, but applying that patch to Drupal 4.6.6 is a pain. Attaching this patch ported to work with 4.6.6

AttachmentSize
comment.module_11.patch.txt 710 bytes

#18

pasupathymahalingam - September 5, 2006 - 11:30
Version:x.y.z» 4.7.3

I found out that in 4.7.3, if you want to add fields into comment form you can extend it by implementing hook_comment() as follows

function _comment($comment, $op)
{
if ($op == 'form') {
$form[''] = array(
'#type' => '',
'#title' => t(''),
'#required' => TRUE,
'#weight' => 0,
);
return $form;
}
}

#19

wundo - September 5, 2006 - 14:29

4.7 Branch already support comment hook.

 
 

Drupal is a registered trademark of Dries Buytaert.