I would like anonymous users to be able to post an ad, but to prevent spam I would like to make them have to answer a captcha math question. I have captcha enabled for creation of new nodes, but this does not appear to apply to creation of new ads with the module in question. Is this something that can be done? Thank you for this incredibly helpful module.

Comments

mcurry’s picture

Project: Classified Ads » CAPTCHA
Version: 4.7.x-1.0 » 4.7.x-1.x-dev
Component: User interface » Miscellaneous
Category: feature » support

Captcha module issue?

What are the requirements to make captcha work on any particular entry form? If the user enables captcha on 'Create a node" form, it should appear on any node creation form, including ed_classified node types.

Also beware of caching issues. If site caching is enabled, anon. user may not see the latest version of a page (including the newly captcha-enabled node creation form.) Be sure the drupal cache is flushed.

mcurry’s picture

ed_classified module form id == 'ed_classified_node_form'

You will have to hand-edit your captcha.module, in this function:

function captcha_settings() {

  //this is where you can add more captcha points
  $captcha_points = array(
                      'comment_form' => t('Comment Form'),
                      'user_login' => t('User Login Form'),
                      'user_login_block' => t('User Login Form Block'),
                      'user_edit' => t('User Edit Form'),
                      'user_register' => t('User Registration Form'),
                      'user_pass' => t('User Forgot Password Form'),
                      'contact_mail_user' => t('User Contact Form'),
                      'contact_mail_page' => t('Sitewide Contact Form'),
                      'node_form' => t('Create a node'),
                    );

  $roles = user_roles();

Add the following line after 'node_form':

                      'ed_classified_node_form' => t('Create a classified ad'),

so that it looks like this:

  $captcha_points = array(
                      'comment_form' => t('Comment Form'),
                      'user_login' => t('User Login Form'),
                      'user_login_block' => t('User Login Form Block'),
                      'user_edit' => t('User Edit Form'),
                      'user_register' => t('User Registration Form'),
                      'user_pass' => t('User Forgot Password Form'),
                      'contact_mail_user' => t('User Contact Form'),
                      'contact_mail_page' => t('Sitewide Contact Form'),
                      'node_form' => t('Create a node'),
                      'ed_classified_node_form' => t('Create a classified ad'),
                    );

Then enable captcha on the "Create a classified ad" form.

There are problems in the captcha module when patched in this manner, though, because it will generate variable names longer than 48 characters, which will cause errors when you save the settings. You will need to widen the variable table's 'name' column to something wider, like 64 characters.

So, for the purposes of this particular support request, you can just hand-edit your site's variable table:

Add the following row to your variable table:

name, value
'ed_classified_node_form_anonymous_user_captcha', 'i:1;'

Don't forget to clear the cache and restart the web server (the variable table is cached by running instances of apache) or do whatever you need to do in order to ensure that the variable table is re-read.

bwv’s picture

Thank you for the prompt and very helpful reply.

mcurry’s picture

Thank you for the prompt and very helpful reply.

You are welcome - I hope you are able to make it work; I'm not sure what I can do with the ed_classified module to make it work well with the captcha module, but I'll do what I can...

Please let me know if my suggestions work for you.

bwv’s picture

Well, it seems that modifying the variable table is a challenge for me. I am using PHPMyAdmin... perhaps you can give me precise instructions? I click variable, then click on the tab at the top that says Insert Row, but after that I haven't a clue where to insert the "name, value" information. Thank in advance.

mcurry’s picture

Title: Captcha for ed-classified.module » Captcha for ed_classified.module - generated variable names overflow 48 characters when saving settings.

I'm afraid I don't use PHPMYAdmin. There's probably a better way do do this, so I'd love to hear someone else chime in. Is there a drupal module that allows you to set a config value from the admin pages? I don't want you to risk damaging your system.

bwv’s picture

Ultimately I could not get this to work, so I've decided instead to use the spam module.

davemybes’s picture

Using PHPMyadmin, click insert row. In the Field column you will see 'name' and 'value'. On the same row as the word name, you will see two boxes, one will be under the column heading 'Value' (note the capital 'V'). In this box, put the following: ed_classified_node_form_anonymous_user_captcha. In the very big box, on the same row as 'value' (note the small 'v'), enter i:1;.

soxofaan’s picture

Closing this issue:

  • Maintenance and support for the CAPTCHA module for drupal 4.7 are already a long time inexistent. Considering that the Drupal 4.7 branch is now officially unmaintained due to the recent Drupal 6.0 release, it is very unlikely this will change.
  • The issue is not applicable to the now recommended 5.x-3.x and 6.x-1.x branches.
soxofaan’s picture

Status: Active » Closed (fixed)

Closing this issue:

  • Maintenance and support for the CAPTCHA module for drupal 4.7 are already a long time inexistent. Considering that the Drupal 4.7 branch is now officially unmaintained due to the recent Drupal 6.0 release, it is very unlikely this will change.
  • The issue is not applicable to the now recommended 5.x-3.x and 6.x-1.x branches.