English 中文(简体)
Sending Facebook notifications
原标题:

I have a little facebook iframe application written with rails and the facebooker plugin. I can loop through the users friends and see whether they also have this application. To do this I use a fql query, and my own html (no fbml). Now i want to create a button right beside every friend who doesn t have this app, that sends an invite massage. Is it possible to do this without this FBML/JS voodoo? I looked through the RESTful api but the only thing i could found was this deprecated method :(

Can someone provide me an code example on how to do this?

I really don t want to use this FBML stuff because it doesn t fit into the ui concept of the app, but if that the only way, please explain how to do this (every fbml tag I ve tried is just invisible :( )

Thanks a lot.

最佳回答

Currently for invite you can only use fb:request-form. inside fb:request-form you need following tag

fb:multi-friend-selector

like this:

<fb:fbml>
  <fb:request-form
  action="index.php" 
  method="POST" 
  invite="true" 
  type="YOUR APP NAME" 
  content="Your text goes here. <?php echo htmlentities("<fb:req-choice url="YOUR CANVAS URL" label="Authorize My Application"") ?>" > 
  <fb:multi-friend-selector showborder="false" actiontext="Invite your friends to use YOUR APP NAME."> 
  </fb:request-form>
  </fb:fbml>

This will display friend selector with invite button and user need to select friends and click on invite. but for you it better to use fb:request-form-submit instead of fb:multi-friend-selector with uid="target frien user id" like this:

<fb:fbml>
  <fb:request-form
  action="index.php" 
  method="POST" 
  invite="true" 
  type="YOUR APP NAME" 
  content="Your text goes here. <?php echo htmlentities("<fb:req-choice url="YOUR CANVAS URL" label="Authorize My Application"") ?>" > 
  <fb:request-form-submit uid="TARGETUID"/> 
  </fb:request-form>
  </fb:fbml>

this one shows just one button to invite specified person. However facebook says going to deprecate fb:request-form-submit but it still works.

For showing FBML you need to make your iframe application XFBML and for that you need to include Facebook Javascript libraries. then put any FBML you want inside .

问题回答

Unfortunately, your only option with an iframe app is to use the fb:serverfbml method. Within that, you are able to use the fb:request-form.

See: http://wiki.developers.facebook.com/index.php/Fb:serverFbml

Its definitely not the way I was hoping to implement one, but it works.





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签