Skip to main content
added 19 characters in body
Source Link
kalabro
  • 7.9k
  • 35
  • 46

Ideally I'd have it such that once the https session was started, any access to the http site bounced them over to https again, until they logged out.

Maybe it can be done on web server side, but I'm not sure.

How to redirect logged in users accessing /user/login to specific page?

Don't forget you can alter any drupal_goto() calls:

/**
 * Implements hook_drupal_goto_alter().
 */
function YOURMODULE_drupal_goto_alter(&$path, &$options, &$http_response_code) {
  global $user;

  if (current_path() == 'user/login' && $path == 'user' && user_is_logged_in()) {
    // Redirect to front page.
    $path = '';
    drupal_set_message(t('Welcome back, %username!', array('%username' => $user->name)));
  }
}

Ideally I'd have it such that once the https session was started, any access to the http site bounced them over to https again, until they logged out.

Maybe it can be done on web server side, but I'm not sure.

How to redirect logged in users accessing /user/login to specific page?

Don't forget you can alter any drupal_goto() calls:

/**
 * Implements hook_drupal_goto_alter().
 */
function YOURMODULE_drupal_goto_alter(&$path, &$options, &$http_response_code) {
  global $user;

  if (current_path() == 'user/login' && user_is_logged_in()) {
    // Redirect to front page.
    $path = '';
    drupal_set_message(t('Welcome back, %username!', array('%username' => $user->name)));
  }
}

Ideally I'd have it such that once the https session was started, any access to the http site bounced them over to https again, until they logged out.

Maybe it can be done on web server side, but I'm not sure.

How to redirect logged in users accessing /user/login to specific page?

Don't forget you can alter any drupal_goto() calls:

/**
 * Implements hook_drupal_goto_alter().
 */
function YOURMODULE_drupal_goto_alter(&$path, &$options, &$http_response_code) {
  global $user;

  if (current_path() == 'user/login' && $path == 'user' && user_is_logged_in()) {
    // Redirect to front page.
    $path = '';
    drupal_set_message(t('Welcome back, %username!', array('%username' => $user->name)));
  }
}
Source Link
kalabro
  • 7.9k
  • 35
  • 46

Ideally I'd have it such that once the https session was started, any access to the http site bounced them over to https again, until they logged out.

Maybe it can be done on web server side, but I'm not sure.

How to redirect logged in users accessing /user/login to specific page?

Don't forget you can alter any drupal_goto() calls:

/**
 * Implements hook_drupal_goto_alter().
 */
function YOURMODULE_drupal_goto_alter(&$path, &$options, &$http_response_code) {
  global $user;

  if (current_path() == 'user/login' && user_is_logged_in()) {
    // Redirect to front page.
    $path = '';
    drupal_set_message(t('Welcome back, %username!', array('%username' => $user->name)));
  }
}