You are here

function fbconnect_redirect_submit in Facebook Connect 6

Same name and namespace in other branches
  1. 5 fbconnect.module \fbconnect_redirect_submit()
  2. 6.2 fbconnect.module \fbconnect_redirect_submit()

Redirects the user to the account linking page.

1 call to fbconnect_redirect_submit()
fbconnect_autoconnect_form_submit in ./fbconnect.module
1 string reference to 'fbconnect_redirect_submit'
fbconnect_form_alter in ./fbconnect.module
Impletementation of hook_form_alter.

File

./fbconnect.module, line 192

Code

function fbconnect_redirect_submit($form, &$form_state) {
  global $user;
  drupal_get_messages('status');
  $fbuid = fbconnect_get_fbuid();
  if ($fbuid) {
    if (fbconnect_register($user->uid, $fbuid)) {
      drupal_set_message(t('Your Facebook connect link is now active'));
    }
    else {
      if (_get_user_fbuid($user->uid)) {
        drupal_set_message(t('This user had been already linked another Facebook account.'), 'error');
      }
      if (_is_fbconnect_user($fbuid)) {
        drupal_set_message(t('This Facebook account had been already linked to another user.'), 'error');
      }
    }
  }
  if ($_REQUEST['destination'] == 'fbconnect') {
    unset($_REQUEST['destination']);
    $form_state['redirect'] = 'user/' . $user->uid . '/edit/fbconnect';
  }
}