I want to hook into the registration module. I already have a database of 50000 users who use my old website. Now I am migrating to Drupal.
I still haven\'t migrated the
You should register an additional validation callback function for the registration form using hook_form_FORM_ID_alter(), somewhat like so:
// Alter the registration form
function yourModuleName_form_user_register_alter(&$form, &$form_state) {
// Add your own function to the array of validation callbacks
$form['#validate'][] = 'yourModuleName_user_register_validate';
}
// Perform your own validation
function yourModuleName_user_register_validate($form, &$form_state) {
// Extract the submitted name
$name = $form_state['values']['name'];
// Check it according to your own logic
$is_valid_name = your_check_for_valid_name();
// File error, when not valid
if (!$is_valid) {
form_set_error('name', t('Name already taken, please choose a different one'));
}
}