How can developers force users to share facebook pages?
I've been seeing this for quite a while now, and am wondering how people achieve it: They create facebook pages, and t开发者_高级运维hen require users to like and share the pages in order to see links.
First, the user must be authenticated with your app. You can't force anonymous users to like your page, etc. After they are authenticated the easiest way to do this is just to use the graph api and call https://graph.facebook.com/me/likes (you will need the extended permission user_likes). After that you can just ensure that your page is listed as one of the user's likes and take action accordingly.
I found an answer to my question after spending quite some time googling. Turns out, as usual, that it was simply the matter of picking the correct keywords.
- Create the fan page you wish to use
- Allow Static FBML application to your page
- Set Static FBML tab to show your title, and publish the content there. With static FBML you can 'choose' who you want to show certain content, accomplishing the desired goal.
Here's a code sample:
<fb:fbml version=”1.1″>
<fb:visible-to-connection>
<a href=’http://www.webmastershelpguide.com/’>Webmaster help</a>
<fb:else>Non-fans will see this content.</fb:else>
</fb:visible-to-connection>
</fb:fbml>
精彩评论