Prabhat Thapa
2010-Nov-23 05:33 UTC
Facebook feed post to user''s wall & friends home page
Hey i am trying to implemet facebook feed post to user''s facebook wall functionality from my web application/website. i tried a lot but still result less. Plz tell me which is the best way to implement facebook feed post in user''s profle. I am using facebooker. I am working in rails 2.3.8 verison. install Facebooker Gem as i also need to fconnect functionality. 1. Here is my dashboard controller ... after login through fconnect we redirect user to "show" action of dashboard controller. class DashboardsController < ApplicationController #before_filter :login_required layout ''index'' #--------- Creatting sub class ---------- class FacebookPublisher < Facebooker::Rails::Publisher def publish_pg_template one_line_story_template "{*actor*} created/updated: restro" short_story_template "{*actor*} created/updated: <a href=''http://www.playgroundrus.com/playgrounds/1''> restro data! ", "testing" end def publish_pg(pg,facebook_session) send_as :user_action from facebook_session.user data :actor => facebook_session.user.first_name end end #--------- End sub class ---------- def show @user = facebook_session.user #----------------------------------------------- # action = Facebooker::Feed::TemplatizedAction.new # action.page_actor_id = "104646262908753" # action.title_template = "test from {actor} did something" # @user.publish_templatized_action(action) #----------------------------------------------- #----------------------------------------------- #f = Facebooker::Session.create #f.post ''facebook.stream.publish'', :uid => @user.id, :message => ''test4'' #----------------------------------------------- #----------------------------------------------- # flash[:user_action_to_publish] FacebookPublisher.create_publish_pg(@user,session[:facebook_session]) #----------------------------------------------- #----------------------------------------------- puts @user.id fb_session = Facebooker::Session.create fb_session.auth_token = @user.session.auth_token fb_session.post("facebook.feed.publishTemplatizedAction", :target_ids => "", :title_template => "Testing a News Feed post on a Page posted by {actor}", :title_data => "{}", :body_template => "Check it out yo says {name}.", :body_data => "{"name": "cbq"}", :body_general => "Here is the body.", :page_actor_id => "104646262908753") #----------------------------------------------- respond_to do |format| format.html end end end Note :-> all the code between "#-----------------------------------------------" are different approaches to post feed into user''s or pages wall but i am still resultless. 1. Here is my layout file data. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <title>Your awsome facebook connected app</title> <%= stylesheet_link_tag ''application'' %> <%= javascript_include_tag :defaults %> <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script> <%= fb_connect_javascript_tag %> <% init_fb_connect "XFBML" %> <% init_fb_connect "XFBML","Api" do %> <%= fb_user_action(flash[:user_action_to_publish]) if flash[:user_action_to_publish] %> <% end %> </head> <body> <p style="color: green"><%= flash[:notice] %></p> <%= yield %> </body> </html> 1. Here is my view file for "show" function with just a logout link. <span><%= link_to "Sign Out", user_session_path, :method => :delete -%></span> Also plz tell me weather should i have to go for another approach instead of facebooker. should i have to update the rails version etc etc. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.