Calling drupal_goto()
, you are avoiding the session is destroyed. The function that invokes hook_user_logout()
(user_logout()) contains the following code.
watchdog('user', 'Session closed for %name.', array('%name' => $user->name));
module_invoke_all('user_logout', $user);
// Destroy the current session, and reset $user to the anonymous user.
session_destroy();
drupal_goto();
drupal_goto() calls drupal_exit(), which means that with your Drupal's execution is interrupted before session_destroy()
is called.
What you can do is changing the code to something similar to the following one.
function ucenter_user_logout($account) {
user_cookie_save(array('ucenter.logoff' => '1'));
}
function ucenter_init() {
// Check the value of the cookie Drupal_visitor_ucenter_logoff
// and print the message if the user precedently logged off.
}