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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tangent’s picture

FileSize
824 bytes

Here is a patch.

Anonymous’s picture

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

moshe weitzman’s picture

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.

tangent’s picture

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.

TDobes’s picture

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

Stefan Nagtegaal’s picture

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

Stefan Nagtegaal’s picture

escoles’s picture

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?

jotarp@www.jotarp.org’s picture

FileSize
674 bytes

Try this.

jgoerzen@changelog.complete.org’s picture

Version: » 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...

varunvnair’s picture

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.

Hanu’s picture

FileSize
698 bytes

This patch works for me and my 4.6.2 installation.

eaton’s picture

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.

koorneef’s picture

Version: 4.6.0 » x.y.z
Status: Closed (duplicate) » Needs review
FileSize
1.02 KB

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

moshe weitzman’s picture

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.

tangent’s picture

Status: Needs work » Closed (duplicate)

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

meba’s picture

FileSize
710 bytes

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

pasupathymahalingam’s picture

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;
}
}

wundo’s picture

4.7 Branch already support comment hook.