Nie działa:
Kod
<script>
var flaga=false;
</script>
<script>
FB.init({appId: "XXX", status: true, cookie: true, xfbml: true});
</script>
<script>
$(document).ready(function(){
FB.login(function(response) {
if (response.session) {
var user_id = response.session.uid;
var page_id = "XXX";
var fql_query = "SELECT uid FROM page_fan WHERE page_id = "+page_id+"and uid="+user_id;
var the_query = FB.Data.query(fql_query);
the_query.wait(function(rows) {
if (rows.length == 1 && rows[0].uid == user_id) {
flaga=true;
} else {
$("nic").show();
}
});
} else {
// user is not logged in
}
});
});
</script>
<script>
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
if(flaga=true) {document.getElementById('msg').innerHTML = "<iframe width='560' height='315' src='http://www.youtube.com/embed/2vniTHnlAFg' frameborder='0' allowfullscreen></iframe>" + response['post_id'];
}}
FB.ui(obj, callback);
}
</script>