Submission handler for the user registration form doesn't work I'm working on a Drupal 7 portal. I added a custom field to the registration form and I would like to get hold of custom field value when the registration form is submitted and before it is stored in the database.

I'm trying to use the submission handler for the registration form and print the content of $form and $form_state, but those values never get printed as message. I installed the Devel module as well.

function user_register_form_submit($form, &amp;$form_state) {
    drupal_set_message('&lt;pre&gt;'. print_r($form, 1) .'&lt;/pre&gt;');
    drupal_set_message('&lt;pre&gt;'. print_r($form_state, 1) .'&lt;/pre&gt;'); 
    drupal_set_message(t('An info message from user_register_form_submit'), 'error');
}


I appreciate any input on what the issue could be.
In hook_form_alter use foloowing code


function MODULENAME_form_alter(&$form, $form_state, $form_id) {
if($form_id == 'user_register_form'){
    $form['#submit'][] = 'module_custom_form_submit';
   }
}


after that use 



function module_custom_form_submit($form, &$form_state) {
    // Do whatever you want.
}