Hi there.
I'm currently using the code below to trigger the "Post To Wall" script in my Facebook iframe app (the script that allows a user to post a certain piece of content to their wall).
I'm pretty dense with this stuff, so I was wondering how I go about -
1) Triggering it from a button / text link (at the minute it automatically pops up when you visit the page)
2) Have multiple variations of it within one page... for example I have various things on my page that I want people to be able to post about. When they click a Post To Wall link I want them to be able to load a box with some pre-defined text in it that will be different for each Post To Wall link they click on.
3) Checking that the user is logged in. At the minute if a user isn't logged in it returns an error. Works fine when they are though. How do I check that the user is logged in / or make it mandatory?
Any help would be greatly appreciated.
C
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js">
</script>
<script>
FB.init({
appId:'xxxxxxxxxxxxxxxxx', cookie:true,
status:true, xfbml:true
});
FB.ui({ method: 'feed',
link: 'http://www.facebook.com/example',
name: 'Example Facebook Page',
caption: 'Example Caption',
description: 'Example Description',
picture: 'http://www.example.com/image.jpg',
message: 'example message to post to walls here'},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
</script>