Return value on a submit handler Below is a hook from the LinkedIn Integration module. 

Then I have a hook form alter in my module and it's all setup and ready to go to call a submit handler.

When the user goes to authorize LinkedIn, and come back, I want to fire some my code. 

The question is I don't know what states or values are after it comes back. I tried this 

function my_module_form_link($form,$form_state, $uid)
{
  dpm($form_state['values']); 
}


but it did not return anything

function linkedin_user_enable_form($form, $form_state, $uid) {
  $form = array();
  $form['#user'] = $uid;
  $form['#action'] = url('linkedin/token/' . $uid);
  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Go to LinkedIn'),
    '#suffix' =&gt; '&lt;p class="description"&gt;' . t('You will be taken to the LinkedIn website in order to complete the process.') . '&lt;/p&gt;',
  );
  return $form;
}
Looking at the linkedin module source code,  there's some ways that can run code on the way back (but only when are logging-in, it seems).

When they are logging-in:


hook_linkedin_external_login: if they don't already have an account and will be asked to register.
hook_linkedin_tie_external_login: if they already have an account and will be logged-in using that account.


When they are associating a linkedin account:


I do not see any hooks or any stable way of running code in this case.


Here's an example on how to hook into hook_linkedin_external_login:

In your mymodule.module file:

function mymodule_linkedin_external_login($uid) {
  // do something
}


But you'll have to be careful since linkedin_auth_linkedin_external_login does a drupal_goto() so you'll have to have your module hook called first, so that your function doesn't get skipped. See how drupal decide execution order of same hook in different modules?