fb:req-choice url 中的变量插值
对于 Facebook Connect 应用程序的邀请功能,我需要能够判断用户响应了哪个邀请。我决定依靠 Facebook UID 来实现这一点。如何将该 ID 包含在 Facebook 为 fb:req-choice 生成的 URL 中?
<fb:request-form action="#{@post_url}"
method="POST"
invite="true"
type="my_app"
content="<fb:name uid='#{current_user.facebook_uid}' useyou='false' /> wants to invite you to to my_app. To join him simple click 'Accept' below.<fb:req-choice url='http://my_app.com/invitation/?fb_uid={uid}' label='Accept' />">
<fb:multi-friend-selector
showborder="false"
actiontext="Invite your Facebook Friends to shop on Yumshare" />
</fb:request-form>
请注意 fb:req-choice 的 url 属性中的 {uid}。这应该是被邀请用户的 uid,因此需要在 Facebook 端填写。这可能吗?
For my invitation feature of my Facebook Connect app I need to be able to tell which invitation a user responds to. I have decided to rely on the Facebook UID for that. How can I include that ID in the url that Facebook generates for fb:req-choice?
<fb:request-form action="#{@post_url}"
method="POST"
invite="true"
type="my_app"
content="<fb:name uid='#{current_user.facebook_uid}' useyou='false' /> wants to invite you to to my_app. To join him simple click 'Accept' below.<fb:req-choice url='http://my_app.com/invitation/?fb_uid={uid}' label='Accept' />">
<fb:multi-friend-selector
showborder="false"
actiontext="Invite your Facebook Friends to shop on Yumshare" />
</fb:request-form>
Notice the {uid} in the url attrib for fb:req-choice. This is supposed to be the uid of the user that is being invited and therefore needs to be filled in on Facebooks side. Is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用的解决方案并不完全等同于上面的解决方案,但足够接近。
当加载包含 fb:req-choice 表单的页面时,生成一个唯一的令牌(当然必须在此时保留该令牌)并将其粘贴到接受 URL 中。像这样:
这样您就可以跟踪邀请,但只能跟踪用户在该操作中邀请的一批朋友。
The solution I used is not totally equivalent to the above, but close enough.
When loading the page containing the fb:req-choice form, generate a unique token, which of course has to be persisted at that point, and stick that into the acceptance url. Like so:
That way you can track the invitation but only in the batch of friends that the user invited in that action.