I have a iFrame FB app (hosted on say mydomain.com) which shows the friend invite dialogue using the following:
<body>
<fb:serverFbml>
&l开发者_开发技巧t;script type="text/fbml">
<fb:fbml>
<fb:request-form action="http://mydomain.com/InviteSent.aspx" method="GET" invite="true" type="Game"
import_external_friends="true" style="background-color:#000"
content="Hey! Come join me, I'm online now! <fb:req-choice url="<%=gameUrl%>; label="Come and play!" />">
<fb:multi-friend-selector max="30" cols="3" rows="4" showborder="true" condensed="false" actiontext="Invite your friends to come and play!" />
</fb:request-form>
</fb:fbml>
</script>
</fb:serverFbml>
</body>
The callback/action page that is called after friends have been successfully invited is definately being called okay, but my problem lays in retrieving the Facebook IDs of those invited. FB documentation says they should be form-posted into 'ids', so my code behind has this (C# ASP.net):
if( Request["ids"] != null )
((Site)Master).FbInviteSent(Request.QueryString.GetValues("ids"));
I have also set authorisation permissions when people add the app, so I don't believe the issue has anything to do with that.
Cheers in advance for any help.
So from the code above, I'm guessing that you're using iFrames and not FBML. What happens is if your next page after the invitation page is a "apps.facebook.com/something" page, the user gets redirected to a third page before landing on the destination page. Thus, by the time the user gets to your destination page all the post variables are lost.
The simple way around this is to redirect the user outside of facebook, do whatever you want with the invited friends, once you're done, redirect the user back to the facebook page.
I hope that helps. -Roozbeh
Don't know how relevant this is, but Roozbeh15 is correct. Im using the Multi-friend selector via PHP. Its imperative that the action='URL' is outside of the facebook application, thus make sure that target="_top" is not present within tags.
Hope this helps anyone else to retrieve ID's of those invited.
I found the problem, it was related to retrieving the ids[] values in C#. I had never seen a string array being passed as a HTTP POST/GET parameter. Below is the corrected code:
if( Request["ids"] != null )
((Site)Master).FbInviteSent(Request.QueryString["ids[]"].ToString().Split(','));
Roozbeh, u said;
I'm guessing that you're using iFrames and not FBML
..in fact you didn't need to guess, I clearly stated that in my first post. Anyway thanks and hope that helps others.
精彩评论