Implementing a callback after user registration I want to run a database query in another CRM database after a user has registered. I have the following function in my sugar_crm module eg:

function sugar_crm_user_register_submit($form, &amp;$form_state)
{       
    // some code to run a database query in SugarCRM
    ddl("User registration form submitted to CRM");         

}


However, the function doesn't appear ever to be called. What am I doing wrong here?
A way is add a submit function to user_register_form submits in form alter.

yourmodule_form_alter(&amp;$from,$form_state,$form_id) {
  if ($form_id == 'user_register_form ) { 
       $form['#submit'][] = 'sugar_crm_user_register_submit';
       }
 }


but I think the better way is setup your custom function in hook_user_insert.this hook triggered when a user registered . you can implement it in your custom module.

  function yourmodule_user_insert(&amp;$edit, $account, $category) {
   // some code to run a database query in SugarCRM
  ddl("User registration form submitted to CRM"); 
  }