fb:req-choice url 中的变量插值

发布于 2024-08-05 15:30:40 字数 800 浏览 2 评论 0原文

对于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半衾梦 2024-08-12 15:30:40

我使用的解决方案并不完全等同于上面的解决方案,但足够接近。

当加载包含 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/?token=#{@token}' label='Accept' />">
   <fb:multi-friend-selector
              showborder="false"
              actiontext="Invite your Facebook Friends to shop on Yumshare" />
</fb:request-form>

这样您就可以跟踪邀请,但只能跟踪用户在该操作中邀请的一批朋友。

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:

<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/?token=#{@token}' label='Accept' />">
   <fb:multi-friend-selector
              showborder="false"
              actiontext="Invite your Facebook Friends to shop on Yumshare" />
</fb:request-form>

That way you can track the invitation but only in the batch of friends that the user invited in that action.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文