Context:
I've created a front-page template file and using the template.php and user-register-block.tpl.php files, I've been able to create a user registration form on the front-page. The only problem is that the CAPTCHA image is too long (it's not applying what I save back in the administration area on the user/captcha/image_captcha page (i.e. - "Code length:" value). Instead of say, '3', it will be 32 image characters long--which hints something that I can't understand, such as an incorrect parm being passed somewhere or something like that.
Here's my code...
template.php:
<?php
function phptemplate_body_class($left, $right) {
if ($left && $right) {
$class = 'sidebars-2';
$id = 'sidebar-side-2';
}
else if ($left || $right) {
$class = 'sidebars-1';
$id = 'sidebar-side-1';
}
if(isset($class)) {
print ' class="'. $class .'"';
}
if(isset($id)) {
print ' id="'. $id .'"';
}
}
if (drupal_is_front_page()) {
drupal_add_js(drupal_get_path('theme', 'isuedtech') . '/scripts/jquery.cycle.all.js');
}
function isuedtech_theme(){
return array(
'user_login_block' => array(
'template' => 'user-login-block',
'arguments' => array('form' => NULL)
),
'user_register' => array(
'template' => 'user-register-block',
'arguments' => array('form' => NULL)
)
);
}
user-register-block.tpl.php:
<div class="form-item" id="edit-name-1-wrapper">
<label for="<?php echo $variables['form']['name']['#id'];?>">Username: <span class="form-required" title="This field is required.">*</span></label>
<input type="text" maxlength="<?php echo $variables['form']['name']['#maxlength'];?>" name="<?php echo $variables['form']['name']['#name'];?>" id="<?php echo $variables['form']['name']['#id'];?>" size="<?php echo $variables['form']['name']['#size'];?>" value="" class="form-text required" />
<div class="description"><?php echo $variables['form']['name']['#description'];?></div>
</div>
<div class="form-item" id="edit-mail-wrapper">
<label for="<?php echo $variables['form']['mail']['#id'];?>">E-mail address: <span class="form-required" title="This field is required.">*</span></label>
<input type="text" maxlength="<?php echo $variables['form']['mail']['#maxlength'];?>" name="<?php echo $variables['form']['mail']['#name'];?>" id="<?php echo $variables['form']['mail']['#id'];?>" size="<?php echo $variables['form']['mail']['#size'];?>" value="" class="form-text required" />
<div class="description"><?php echo $variables['form']['mail']['#description'];?></div>
</div>
<input type="<?php echo $variables['form']['timezone']['#type'];?>" name="<?php echo $variables['form']['timezone']['#name'];?>" id="<?php echo $variables['form']['timezone']['#id'];?>" value="<?php echo $variables['form']['timezone']['#default_value'];?>" />
<input type="<?php echo $variables['form']['form_build_id']['#type'];?>" name="<?php echo $variables['form']['form_build_id']['#name'];?>" id="<?php echo $variables['form']['form_build_id']['#id'];?>" value="<?php echo $variables['form']['form_build_id']['#value'];?>" />
<input type="<?php echo $variables['form']['form_id']['#type'];?>" name="<?php echo $variables['form']['form_id']['#name'];?>" id="<?php echo $variables['form']['form_id']['#id'];?>" value="<?php echo $variables['form']['form_id']['#value'];?>" />
<fieldset class="captcha">
<legend>CAPTCHA</legend>
<div class="description"><?php echo $variables['form']['captcha']['#description'];?></div>
<input type="<?php echo $variables['form']['captcha']['captcha_sid']['#type'];?>" name="<?php echo $variables['form']['captcha']['captcha_sid']['#parents'][0];?>" id="<?php echo $variables['form']['captcha']['captcha_sid']['#id'];?>" value="<?php echo $variables['form']['captcha']['captcha_sid']['#value'];?>" />
<input type="<?php echo $variables['form']['captcha']['captcha_token']['#type'];?>" name="<?php echo $variables['form']['captcha']['captcha_token']['#name'];?>" id="<?php echo $variables['form']['captcha']['captcha_token']['#id'];?>" value="<?php echo $variables['form']['captcha']['captcha_token']['#value'];?>" />
<?php echo $variables['form']['captcha']['captcha_widgets']['captcha_image']['#value'];?>
<div class="form-item" id="edit-captcha-response-wrapper">
<label for="edit-captcha-response"><?php echo $variables['form']['captcha']['#description'];?> <span class="form-required" title="This field is required.">*</span></label>
<input type="text" maxlength="<?php echo $variables['form']['captcha']['captcha_widgets']['captcha_response']['#maxlength'];?>" name="<?php echo $variables['form']['captcha']['captcha_widgets']['captcha_response']['#name'];?>" id="<?php echo $variables['form']['captcha']['captcha_widgets']['captcha_response']['#id'];?>" size="<?php echo $variables['form']['captcha']['captcha_widgets']['captcha_response']['#size'];?>" value="" class="form-text required" />
<div class="description"><?php echo $variables['form']['captcha']['captcha_widgets']['captcha_response']['#description'];?></div>
</div>
</fieldset>
<input type="<?php echo $variables['form']['submit']['#type'];?>" name="<?php echo $variables['form']['submit']['#name'];?>" id="<?php echo $variables['form']['submit']['#id'];?>" value="<?php echo $variables['form']['submit']['#value'];?>" class="form-submit" />
The biggest reason I did all this was to simply have full control of the registration form and put it on the front-page for styling. I think I'm very close to having what I've set out to get here because using WinDiff, I can't see any major errors--everything is there. It's just this image that's wrong and ONLY wrong when I apply my theme modifications, meaning, ONLY the user registration theme changes. Nothing else.
I'm thinking this might have something to do with some preprocessor arguments, but I'm pretty lost on this. Any help is very appreciated.
(See attached image as a sample of what it's basically generating...)
| Comment | File | Size | Author |
|---|---|---|---|
| sample.jpg | 11.21 KB | wolf_22 |
Comments
Comment #1
soxofaan commentedThe 32 character you are seeing is the random initialization of the captcha solution (captcha.inc, _captcha_generate_captcha_session()), which is overwritten in captcha_pre_render_process() (see captcha.module).
Something is probably broken in the form processing pipeline on your setup.
Comment #2
wundo commented