You are here

function login_destination_validate in Login Destination 7

Helper submit function.

1 string reference to 'login_destination_validate'
login_destination_form_alter in ./login_destination.module
Implements hook_form_alter().

File

./login_destination.module, line 199
Control where users are directed to, once they login

Code

function login_destination_validate($form, &$form_state) {

  // LoginToboggan's unified page is rendered dynamically. Fix it.
  switch ($form['#form_id']) {
    case 'user_register_form':
      if (drupal_match_path($_GET['q'], 'user')) {
        $_GET['q'] = 'user/register';
      }
      break;
    case 'user_login':
      if (drupal_match_path($_GET['q'], 'user/register')) {
        $_GET['q'] = 'user';
      }
      break;
  }

  // Fix the current page in case of 403 page.
  if ($form['#form_id'] == 'user_login') {
    if (drupal_get_http_header('Status') == '403 Forbidden') {
      $_GET['current'] = $_GET['destination'];
    }
  }
}