Что ж, для этого вам нужно будет использовать API Javascript Facebook, чтобы определить, когда пользователь вошел в систему или вышел из нее, а затем сделать AJAX-запрос на обновление вашего заголовка.Это будет сделано через FB.Event.subscribe, как указывает следующий фрагмент:
window.fbAsyncInit = function() {
FB.init({
appId : 'YOURAPPID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelUrl : 'http://www.yourdomain.com/channel.html', // Custom Channel URL
oauth : true //enables OAuth 2.0
});
// retrieve the login status.
FB.getLoginStatus(function(response) {
if (response.authResponse) update_user_is_connected();
else update_user_is_not_connected();
});
// This will be triggered as soon as the user logs into Facebook (through your site)
FB.Event.subscribe('auth.login', function(response) {
// Here you would update your header.
update_user_is_connected();
});
};
Подробнее о FB.Event.subscribe можно прочитать здесь: http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
Обратите вниманиеэтот код взят из предыдущих ответов моего.