Open register.php, find
$form_data = array(
array('label', $lang_register_php['required_info']),
array('input', 'username', $icon_array['username'] . $lang_register_php['username'], 25),
array('password', 'global_registration_pw', $icon_array['password'] . $lang_register_php['global_registration_pw'], 25),
array('password', 'password', $icon_array['password'] . $lang_register_php['password']),
array('password', 'password_verification', $icon_array['password'] . $lang_register_php['password_again']),
array('input', 'email', $icon_array['email'] . $lang_register_php['email'], 255),
array('label', $lang_register_php['optional_info'])
);
$optional_data = 0;
if ($CONFIG['user_profile1_name'] != '') {
$form_data[] = array('input', 'user_profile1', $icon_array['blank'] . $CONFIG['user_profile1_name'], 255);
$optional_data++;
}
and replace with
$form_data = array(
array('label', $lang_register_php['required_info']),
array('input', 'username', $icon_array['username'] . $lang_register_php['username'], 25),
!empty($CONFIG['global_registration_pw']) ? array('password', 'global_registration_pw', $icon_array['password'] . $lang_register_php['global_registration_pw'], 25) : '',
array('password', 'password', $icon_array['password'] . $lang_register_php['password']),
array('password', 'password_verification', $icon_array['password'] . $lang_register_php['password_again']),
array('input', 'email', $icon_array['email'] . $lang_register_php['email'], 255),
!empty($CONFIG['user_profile1_name']) ? array('input', 'user_profile1', $icon_array['blank'] . $CONFIG['user_profile1_name'], 255) : '',
array('label', $lang_register_php['optional_info'])
);
$optional_data = 0;
find
$profile1 = $superCage->post->getEscaped('user_profile1');
and replace with
$profile1 = trim(get_post_var('user_profile1'));
find
if ($password != $password_again) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['password_verification_warning1'] . '</li>';
}
below, add
if (utf_strlen($profile1) < 2) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">Value \'' . $CONFIG['user_profile1_name'] . '\' must be at least two characters long!</li>';
}
If you want to show an error message before the form will be submitted, open register.php, find
if (isset($lang_register_php[$element[1].'_warning2']) == TRUE) {
$warning2 = '<div id="'.$element[1].'_warning2" class="cpg_message_validation formFieldWarning" style="display:none;">' . $lang_register_php[$element[1].'_warning2'] . '</div>';
} else {
$warning2 = '';
}
below, add
if ($element[1] == 'user_profile1') {
$warning1 = '<div id="user_profile1_warning1" class="cpg_message_validation formFieldWarning" style="display:none;">';
$warning1 .= 'The ' . $CONFIG['user_profile1_name'] . ' mustn\'t be empty!';
$warning1 .= '</div>';
$warning2 = '<div id="user_profile1_warning2" class="cpg_message_validation formFieldWarning" style="display:none;">';
$warning2 .= 'The ' . $CONFIG['user_profile1_name'] . ' must be at least two characters long!';
$warning2 .= '</div>';
}
open js/register.js, find
if (errors != 0) {
$('#form_not_submit_top').show();
$('#form_not_submit_bottom').show();
return false;
} else {
return true;
}
above, add
// Check user_profile1
if($('#user_profile1').val() == '') {
$('#user_profile1_warning1').show();
errors++;
} else {
if ($('#user_profile1').val().length < 2 ) {
$('#user_profile1_warning2').show();
errors++;
}
}