If there aren't modules that avoid the redirection happens, the only case the redirection from user/logout to the front page doesn't happen is when the user is already logged out. user/logout is defined as the following, in user_menu().
$items['user/logout'] = array(
'title' => 'Log out',
'access callback' => 'user_is_logged_in',
'page callback' => 'user_logout',
'weight' => 10,
'menu_name' => 'user-menu',
'file' => 'user.pages.inc',
);
When a menu is accessed from the users, Drupal first calls the access callback; if the access callback returns TRUE
, then Drupal calls the page callback. In this case, the redirection is done from the page callback, which is never called when the user is logged out. (In that case, user_is_logged_in() returns FALSE
.)
For a page like user/logout, the login block is not shown. In fact, user_block_view() contains the following code, used to render the login block.
// For usability's sake, avoid showing two login forms on one page.
if (!$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))) {
$block['subject'] = t('User login');
$block['content'] = drupal_get_form('user_login_block');
}
return $block;
What you can do is implementing hook_block_view_MODULE_DELTA_alter() to show the login block also on user/logout, in the case the redirection to the front page doesn't happen for any reason.
function mymodule_block_view_user_login_alter(&$data, $block) {
if (!$GLOBALS['user']->uid && $_GET['q'] == 'user/logout') {
$data['subject'] = t('User login');
$data['content'] = drupal_get_form('user_login_block');
}
}