Heine

  • home
  • drupal
  • drupal core commits
  • about
Home › Forums › MyCaptcha › Bug reports

Handle position in forms better (Contact, CCK forms)

Benj — Sat, 02/06/2007 - 12:57

Hi,
on cck content add/edit forms, the mycaptcha field seems randomly placed: it can appear in the middle of the form instead of being at the very bottom.

It would be good if you could fix this so the catcha field would systematically be displayed at the bottom of cck add/edit forms.

Cordially,
Benj

No votes yet
‹ Mycaptcha and uieforum MyCaptcha not showing up ›
  • Bug reports
  • Login or register to post comments

I'll see what I can do about it

Heine — Mon, 04/06/2007 - 21:26

Thanks Benj,

The very bottom would indeed be a preferable location. I'll see what I can do about it, but I can't promise it will be done before the next weekend.

Kind regards,

Heine

  • Login or register to post comments

patch for the mycaptcha form weight problem

Anonymous (not verified) — Thu, 02/08/2007 - 19:47

here's a patch for mycap.module which enables a "weight" option in the mycaptcha admin area.

@@ -137,6 +137,13 @@
         );
       }
     }
+
+    $form['captcha_weight'] = array(
+      '#title' => t('Captcha weight'),
+      '#type' => 'weight',
+      '#default_value' => variable_get('mycap_captcha_weight', '0'),
+    );
+
     $form['button']['save'] = array(
       '#type' => 'submit',
       '#value' => t('Save'),
@@ -158,6 +165,7 @@
  */
 function mycap_settings_form_submit($form_id, $form_values) {
   variable_set('mycap_captcha_type', $form_values['captcha_type']);
+  variable_set('mycap_captcha_weight', $form_values['captcha_weight']);
   $captcha_setting = $form_values['captcha_setting'];
   foreach ($captcha_setting as $rid => $settings) {
     foreach ($settings as $variable => $enabled) {
@@ -275,6 +283,8 @@
     $form['#validate']['mycap_validate_captcha'] = array();
     $form['#pre_render'][] = 'mycap_prerender_captcha';
     $form['#submit']['mycap_unset_captcha'] = array();
+
+    $form['captcha']['#weight'] = variable_get('mycap_captcha_weight', '0');
 
     // Prevent caching of this page.
     $GLOBALS['conf']['cache'] = FALSE;
@@ -680,4 +690,4 @@
     }
     $x += $char_width + mt_rand(-1, $max_delta_x);
   }
-}

  • Login or register to post comments

COmmit

Benj — Sun, 05/08/2007 - 11:08

Hi,
can this be commited to mycaptcha ?

I'm a bit disapointed that this module isn't updated more often.

Cordially,
Benj

  • Login or register to post comments

My spare time is

Heine — Sun, 05/08/2007 - 19:08

My spare time is limited.

The patch above is not a good solution IMO, because the weight the captcha should get depends on the form.

  • Login or register to post comments

Recent posts

  • Unserializing user-supplied data, a bad idea
  • Planet Drupal past and current
  • Help! - Cannot access a global variable.
  • Why is my module's update hook not listed on update.php's selection form?
  • How do I add a class to a link generated with l()
more

Security reviews

  • Afraid custom code makes your site vulnerable?
  • You don't really trust that module you just downloaded from Drupal.org?

Sleep better after a security review.

Tags

Captcha CSRF Drupal embed Input Format modx OpenID Performance Planet Drupal rants Security Varnish
more tags
  • home
  • drupal
  • drupal core commits
  • about

Copyright © 2010 by Heine Deelstra. All rights reserved.