function linkedin_auth_form_alter in LinkedIn Integration 7
Same name and namespace in other branches
- 6 linkedin_auth/linkedin_auth.module \linkedin_auth_form_alter()
Implements hook_form_alter : adds LinkedIn login to the login forms().
File
- linkedin_auth/
linkedin_auth.module, line 67 - Implement LinkedIn Authentication service for user login
Code
function linkedin_auth_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
//add login link to the login form
case 'user_login_block':
if (variable_get('linkedin_auth_login_link_on_block', 0) == 1) {
$form['linkedin_auth_links'] = array(
'#markup' => theme('linkedin_auth_display_login_block_button', array(
'display' => 'drupal_login_block',
)),
'#weight' => 1,
);
}
break;
case 'user_login':
if (variable_get('linkedin_auth_login_link_on_page', 0) == 1) {
$form['linkedin_auth_links'] = array(
'#markup' => theme('linkedin_auth_display_login_block_button', array(
'display' => 'drupal_login_page',
)),
'#weight' => 1,
);
}
break;
//Register using linkedin.
case 'user_register_form':
if (variable_get('linkedin_auth_bypass_register_checks', 0) == 1 && isset($_SESSION['linkedin_auth_register_bypass'])) {
$form_state['#redirect'] = isset($_GET['destination']) ? $_GET['destination'] : '';
//Only remove standard register submit, but play nicely wth other modules.
$key = array_keys($form['#submit'], 'user_register_submit');
unset($form['#submit'][$key[0]]);
$form['#submit'][] = 'linkedin_auth_register_form_submit';
}
break;
}
return $form;
}