You are here

function fancy_login_user_login_block_ahah_callback in Fancy Login 6.2

File

includes/fancy_login.pages.inc, line 274

Code

function fancy_login_user_login_block_ahah_callback($form) {
  global $destination;
  $messages = drupal_get_messages(NULL, FALSE);
  if (!isset($messages['error']) || !count($messages['error'])) {
    if (variable_get('fancy_login_no_redirect', 0)) {
      drupal_set_message(t('You have been successfully logged in. Please wait the page is refreshed.'));
      $form['close_popup'] = array(
        '#value' => '<div id="fancy_login_close_popup"></div>',
      );
      $form['refresh_page'] = array(
        '#value' => '<div id="fancy_login_refresh_page"></div>',
      );
    }
    else {
      drupal_set_message(t('You have been successfully logged in. Please wait while you are redirected.'));
      $dest = $destination && is_array($destination) && isset($destination[0]) ? $destination[0] : $form_state['redirect'];
      if (!strlen($dest)) {
        $dest = 'user';
      }
      $form['close_popup'] = array(
        '#value' => '<div id="fancy_login_close_popup"></div>',
      );
      $form['refresh_page'] = array(
        '#value' => '<div id="fancy_login_redirect_page">' . url($dest) . '</div>',
      );
    }
  }
  return $form;
}