You are here

function login_destination_translated_menu_link_alter in Login Destination 7

Implements hook_translated_menu_link_alter().

File

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

Code

function login_destination_translated_menu_link_alter(&$item, $map) {
  $paths = array(
    'user/login',
    'user',
  );

  // Append the current path to URL.
  if ($item['link_path'] == 'user/logout' || in_array($item['link_path'], $paths) && user_is_anonymous()) {
    $current = $_GET['q'];
    if ($current == '<front>') {
      $current = '';
    }
    $item['localized_options']['query'] = array(
      'current' => $current,
    );
  }
}