I have called a custom function on form submit of Drupal User Registration.
Below are the functions that i implemented
/**
* Implements hook_form_alter()
*/
function voen_registration_form_alter(&$form, &$form_state, $form_id) {
//dpm($form);
switch($form_id){
case 'user_register_form':
$form['account']['name']['#required'] = FALSE;
$form['account']['name']['#type'] = 'hidden';
array_unshift($form['#submit'],'voen_generate_username');
print_r($form);
break;
}
}
function voen_generate_username(&$form, &$form_state){
//drupal_set_message('Function Running');
die('Wokring');
}
Now, when the form is submitted i print_r the $form and in submit key i get the following result which is what i expect
[#submit] => Array
(
[0] => voen_generate_username
[1] => user_register_submit
)
But I don't know why my custom function is not executing. I tried with die() as well se drupal_set_message() and also tried to print_r() in custom function but no response. It is still giving me error of 'Please Enter Username' which is comming from user_register_submit function from user module.
Thanks