开发者

Facebook Application Requests: How to determine who's invited whom?

开发者 https://www.devze.com 2023-01-24 22:29 出处:网络
We\'re about to build a Facebook application that will run inside an XFBML IFrame. We already found a good tutorial for that (kudos to the author). Right now, there\'s one more issue we need to deal w

We're about to build a Facebook application that will run inside an XFBML IFrame. We already found a good tutorial for that (kudos to the author). Right now, there's one more issue we need to deal with.

开发者_运维技巧Basically, we just wanted to know how to determine the UID of the person who invited a friend to join an application. Say for example, user A invites user B to join Cool-App. User B sees the application request, and responded by accepting the invitation. Now the question is, how are we going to know that user B was referred by user A?

Help please.


Well, luckily we found the closest possible answer.

FBML has fb:req-choice tag which we normally use inside fb:request-form. Can also be embedded in the Content attribute of the latter.

It looks like this:

<fb:req-choice url="URL_HERE" label="BUTTON_TEXT_HERE"/>

..where URL_HERE is your application-base-url plus a relative path to somewhere like so:

http://apps.facebook.com/my_cool_app/path/to/somewhere

e.g:

http://apps.facebook.com/my_cool_app/users/invite/referred-by/1234567890

This actually is the button which the user "accepts" or "confirms". When triggered, FB redirects to the link you provided.

That's it. The rest is up to your application.


When using the FBML request-form tag, you can retrieve the invited users as a POST var.
php example:

if(isset($_POST["ids"])) {
    echo "<center>Thank you for inviting ".sizeof($_POST["ids"])." of your friends on <b><a href=\"http://apps.facebook.com/".$app_url."/\">".$app_name."</a></b>.<br><br>\n";
    echo "<h2><a href=\"http://apps.facebook.com/".$app_url."/\">Click here to return to ".$app_name."</a>.</h2></center>";
}

There is no way that I know of to find out if the invited user actually accepted this particular invitation. (f.e. What if he also gets a request from user C?)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号