You are here

function fbconnect_redirect_submit in Facebook Connect 6.2

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

Redirects the user to the account linking page. @todo refactor it

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

File

./fbconnect.module, line 152
Integration with Facebook Connect API.

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 (_fbconnect_get_user_fbuid($user->uid)) {
        drupal_set_message(t('This user had been already linked another Facebook account.'), 'error');
      }
      if (_fbconnect_is_user($fbuid)) {
        drupal_set_message(t('This Facebook account had been already linked to another user.'), 'error');
      }
    }
  }
  if ($_REQUEST['destination'] == 'fbconnect/link') {
    unset($_REQUEST['destination']);
    $form_state['redirect'] = 'user/' . $user->uid . '/edit/fbconnect';
  }
}