3
votes

I am working on a module that connects Drupal to an external Web Service. When a user registers, I want him to register in the web service and not in Drupal. I want to override the submit function that is called when the user_register form is submitted.

I already use $form['#submit'], but its not working.

Any other solution? I am using drupal7.

I used like that

function mymodule_form_user_register_form_alter(&$form, &$form_state, $form_id) { 
$form['account']['name']['#title'] = t('Full name'); // perform other changes here 
$form['#submit'][] = 'mymodule_user_register_form_submit' 
} 
1
Can you paste your code?, the way to do this is using $form['#submit'] - m4t1t0

1 Answers

3
votes

When you use

$form['#submit'][] = 'mymodule_user_register_form_submit' 

you are not actually overriding the submit module. You are saying after executing the submit function created by all other modules(which were run before mine), also execute my function mymodule_user_register_form_submit

If you want to override the submit function use something like $form['#submit'] = 'mymodule_user_register_form_submit' which will make sure that your function is the only function that will get executed.