The captcha image should appear above the submit button...

With the patch I search for the form element that is of type "submit" and I insert the capcha image before that element...

CommentFileSizeAuthor
textimage.patch_2.txt895 bytesednique

Comments

ñull’s picture

Just applying the patch did not do the job for me. Do I need to clear the cache before I the effects of this patch?

budda’s picture

Priority: Normal » Critical

This is still a problem in 4.7 build in May 2007.

ednique’s picture

Long time since I posted the patch...
just change the textimage_captchachallenge() function in the textimage.module to this:

function textimage_captchachallenge(&$form) {
  /* added by ednique :: captcha placement before submit button! */
  $newform = array();
  $added = false;
  foreach ($form as $name => $element) {
    if ($element['#type'] == 'submit'){
      $newform['captcha_response'] = array (
        '#type' => 'textfield',
        '#title' => t('Captcha Validation'),
        '#default_value' => '',
        '#required' => TRUE,
        '#validate' => array('_captcha_validate' => array()),
        '#description' => t('Please type in the letters/numbers that are shown in the image above.'),
        '#prefix' => '<div class="textimage-challenge"><img src="' . url('_textimage/image/'.time()) . '" '.$imageSize[3].'  alt="'.t('Captcha Image: you will need to recognize the text in it.').'"/></div>',
      );
	  $added = true;
    }
	$newform[$name] = $form[$name];
  }
  if($added) {
	$form = $newform; // set the form! it is updateble
  } else {
    /* original code */
	$form['captcha_response'] = array (
      '#type' => 'textfield',
      '#title' => t('Captcha Validation'),
      '#default_value' => '',
      '#required' => TRUE,
      '#validate' => array('_captcha_validate' => array()),
      '#description' => t('Please type in the letters/numbers that are shown in the image above.'),
      '#prefix' => '<div class="textimage-challenge"><img src="' . url('_textimage/image/'.time()) . '" '.$imageSize[3].'  alt="'.t('Captcha Image: you will need to recognize the text in it.').'"/></div>',
    );
  }
  return $form;
}
ednique’s picture

Version: 5.x-2.x-dev » 4.7.x-1.x-dev

It's for version 4.7.x !

deciphered’s picture

Status: Needs review » Closed (fixed)

I will not be maintaining the 4.7.x branch, if anyone wishes to they are more than welcome to contact me.