Comment 2 for bug 1599241

Revision history for this message
Aaron Wells (u-aaronw) wrote :

... in other words in the file htdocs/artefact/comment/lib.php, you find the function "add_comment_form", which contains the definition for the comments form. In the "if (!$USER->is_logged_in())" block, you add $form['elements']['captcha'] = array('type' => 'captcha').

You'll also need to go to the Site Configuration page, enable recaptcha, and put in a recaptcha private & public key (you can get these at recaptcha.org). Once you've done that, recaptcha will show up on the comment form for logged-out users.

As mentioned above, though, this basic implementation of it doesn't completely work. I think you'd probably need to hook into Pieform's clumsy Javascript side of things to get the Javascript to properly load up the recaptcha after submitting the form. A starting point for that might be in the file htdocs/lib/form/elements/captcha.php, and looking at how we do it for TinyMCE (htdocs/lib/form/elements/wysiwyg.php) might be a useful starting point.

Cheers,
Aaron