Is there a Ubercart module to ask the user to insert his email twice in the checkout page?
Asked
Active
Viewed 443 times
3 Answers
2
There is an email confirmation checkbox in ubercart checkout settings. No additional modules needed.

user1031742
- 404
- 1
- 6
- 20
1
I doubt there is a module for this. You can do this with hook_form_alter
in a custom module. Should only be 10-20 lines of code.
Something like
function module_form_FORM_ID_alter(&$form, &$form_state) {
$form['...']['second_mail'] = array(
'#title' => t('Verify E-mail'),
'#type' => 'textfield',
'#weight' => xx,
);
$form['#validate'][] = 'module_validate_function_name';
}
function module_validate_function_name(&$form, &$form_state) {
if ($form_state['values']['mail'] != $form_state['values']['second_mail']) {
form_set_error('second_mail', t('You have mistyped your e-mail, please verify');
}
}
The above is example code, but might actually work, it depends how the ubercart checkout form is created, more specifically, the name of it's mail field.
There are a few blanks but it should be easy enough to fill out.

googletorp
- 33,075
- 15
- 67
- 82
1
I got it working by using this:
/* Code to add confirm email for uc checkout */
function custom_code_form_alter(&$form, $form_state, $form_id) {
if($form_id == "uc_cart_checkout_form" && $form['panes']['customer']['primary_email']['#type'] != 'hidden'){
$form['panes']['customer']['primary_email']['#weight'] = '0';
$form['panes']['customer']['new_account']['#weight'] = '2';
$form['panes']['customer']['confirm_email'] = array(
'#title' => t('Verify E-mail address'),
'#type' => 'textfield',
'#size' => '32',
'#required' => true,
'#weight' => '1'
);
$form['#validate'][] = 'custom_code_validate_confirm_email';
}
}
function custom_code_validate_confirm_email(&$form, &$form_state){
if($form_state['values']['panes']['customer']['primary_email'] != $form_state['values']['panes']['customer']['confirm_email']) {
form_set_error('panes[customer][confirm_email', t('Email addresses must match.'));
}
}
/* end code for confirm_email */

shane
- 11
- 2