<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/controllers/open_id_registrations_controller.rb</filename>
    </added>
    <added>
      <filename>app/helpers/open_id_registrations_helper.rb</filename>
    </added>
    <added>
      <filename>app/models/facebook_identity.rb</filename>
    </added>
    <added>
      <filename>app/views/open_id_registrations/error.html.erb</filename>
    </added>
    <added>
      <filename>config/facebooker.yml</filename>
    </added>
    <added>
      <filename>db/migrate/20090107200544_create_facebook_identities.rb</filename>
    </added>
    <added>
      <filename>lib/facebook_utils.rb</filename>
    </added>
    <added>
      <filename>public/javascripts/facebooker.js</filename>
    </added>
    <added>
      <filename>public/xd_receiver.html</filename>
    </added>
    <added>
      <filename>spec/controllers/open_id_registrations_controller_spec.rb</filename>
    </added>
    <added>
      <filename>spec/fixtures/facebook_identities.yml</filename>
    </added>
    <added>
      <filename>spec/helpers/open_id_registrations_helper_spec.rb</filename>
    </added>
    <added>
      <filename>spec/models/facebook_identity_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 class AjaxValidationsController &lt; ApplicationController
   
+  skip_before_filter :load_user
+  
   def validate_email
     respond_to do |wants|
       wants.html {  }</diff>
      <filename>app/controllers/ajax_validations_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,15 +19,33 @@ class ApplicationController &lt; ActionController::Base
   # from your application log (in this case, all fields with names like &quot;password&quot;). 
   filter_parameter_logging :password, :password_confirmation, :old_password
   
+  before_filter :set_facebook_session
   before_filter :load_user
+  helper_method :facebook_session
   
   private
   
     def load_user
       @user_session = UserSession.find
       @current_user = @user_session &amp;&amp; @user_session.record
+      
+      if @current_user.nil? &amp;&amp; (params[:controller] != 'third_party_registrations_controller')
+        load_facebook_user
+      end
     end
   
+    def load_facebook_user
+      # if the session isn't secured, we don't have a good user id
+      if facebook_session and facebook_session.secured? and !request_is_facebook_tab?
+        if face_id = FacebookIdentity.find_by_facebook_id( facebook_session.user.id ) 
+          @current_user = face_id.user
+        else
+          # we have a facebook_session not associated with a user so redirect to complete registration page.
+          redirect_to :action =&gt; 'edit', :controller =&gt; :third_party_registrations
+        end
+      end
+    end
+    
     def store_location
       session[:return_to] = request.request_uri
     end</diff>
      <filename>app/controllers/application.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,73 +1,31 @@
 class ThirdPartyRegistrationsController &lt; ApplicationController
   
-  include OpenIdUtils
-  
   layout 'full_width'
   
   before_filter :require_no_user
   
+  # skip_filter :load_user, :only =&gt; [:edit, :update]
   
   # GET /third_party_registration/new
+  # Displays the third party registration form. That view will then post to the correct controller for the 
+  # specific kind of registration method selected.
   def new
     @openid_identifier = params[:openid_identifier]
   end
   
-  # The entry point action for User and UserSession creation.
-  # Applies business rules to determine if open_id_authentication should be used vs. the regular un/pw process.
-  #
-  # if the user entered an email
-  #   if the email matches an account 
-  #     error - user already exists
-  #   else no account
-  #     if EAUT returns an openid 
-  #       do openid
-  #     else 
-  #       do un/pw
-  # else
-  #   try openid with whatever the user provided
-  def create
-    
-    if using_open_id?
-      open_id_authentication( :required =&gt; [ :email ], :optional =&gt; [ :nickname ] )
-      
-    else # the field entered is an email 
-      
-      if user = User.find_by_email( params[:openid_identifier] )
-        flash[:error] = 'An account with this email already exists.'
-        @openid_identifier = params[:openid_identifier]
-        render :action =&gt; :new
-      
-      else  
-        # try EAUT # TODO: Refactor acts_as_eaut to yield a result wrapping status and error messages
-        begin
-          eaut_id = get_openid_for_email( params[:openid_identifier], :use_fallback_service =&gt; false )
-        rescue
-        end
-
-        if eaut_id
-          params[:openid_identifier] = eaut_id
-          open_id_authentication( :required =&gt; [ :email ], :optional =&gt; [ :nickname ] )
-        
-        else
-          # TODO check what they want to do here? display error page : redirect to un/pw
-          redirect_to new_user_path # do un/pw signup
-          
-        end # if eaut_id
-      end # if user exists
-    end # if using_open_id?
-  end
-  
-
+  # This action displays the complete registration form.
   def edit
     @user = User.new params[:user]
   end
   
   def update
 
-    redirect_to( :action =&gt; 'new' ) and return unless session[:openid_identifier] 
+    redirect_to( :action =&gt; 'new' ) and return unless ( session[:openid_identifier] || ( facebook_session &amp;&amp; facebook_session.user ) )
 
     @user = User.new params[:user]
-    @user.open_ids &lt;&lt; OpenId.new( :openid_identifier =&gt; session[:openid_identifier] )
+    
+    @user.open_ids &lt;&lt; OpenId.new( :openid_identifier =&gt; session[:openid_identifier] ) if session[:openid_identifier]
+    @user.facebook_identity = FacebookIdentity.new( :facebook_id =&gt; facebook_session.user.id ) if ( facebook_session &amp;&amp; facebook_session.user )
     
     respond_to do |format|
       if @user.save
@@ -82,21 +40,4 @@ class ThirdPartyRegistrationsController &lt; ApplicationController
       end
     end
   end
-  
-  private
-
-    def successful_openid_authentication( openid_identifier, registration = {} )
-      if user = User.find_by_open_id(openid_identifier)      
-        flash[:error] = &quot;This OpenID is already in use.&quot;
-        render :action =&gt; 'new'
-      else
-        session[:openid_identifier] = openid_identifier
-        redirect_to :action =&gt; 'edit', :user =&gt; { :screen_name =&gt; registration['nickname'], :email =&gt; registration['email'] }
-      end
-    end
-
-   def failed_openid_authentication( message )
-     render :template =&gt; 'third_party_registrations/error'
-   end
-  
 end</diff>
      <filename>app/controllers/third_party_registrations_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,15 @@ class UserSessionsController &lt; ApplicationController
   # Logs the user out.
   # Mapped to route /logout
   def destroy
-    @user_session.destroy
+    @user_session.destroy if @user_session
+    
+    # handle facebook cookies
+    cookies.keys.each do |key|
+      if key =~ Regexp.new( Facebooker.api_key )
+        cookies.delete key
+      end
+    end
+    
     flash[:notice] = 'Logout successful!'
     redirect_to login_url
   end
@@ -40,7 +48,7 @@ class UserSessionsController &lt; ApplicationController
   # else
   #   try openid with whatever the user provided
   def create
-    
+      
     if using_open_id?
       open_id_authentication :using_ajax =&gt; true
       </diff>
      <filename>app/controllers/user_sessions_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,11 @@
 # == Schema Information
-# Schema version: 20081119192750
+# Schema version: 20090107200544
 #
 # Table name: users
 #
 #  id                    :integer(4)      not null, primary key
 #  screen_name           :string(50)
+#  first_name            :string(50)
 #  email                 :string(255)
 #  crypted_password      :string(255)
 #  password_salt         :string(255)
@@ -37,6 +38,7 @@ class User &lt; ActiveRecord::Base
   attr_accessor :password_confirmation
   
   has_many :open_ids, :dependent =&gt; :destroy
+  has_one :facebook_identity, :dependent =&gt; :destroy
   
   def to_param
   	screen_name
@@ -110,9 +112,9 @@ class User &lt; ActiveRecord::Base
   
   def validate_password
     # TODO: Check if we should do any pw length or contents validation...
-    if password.to_s.empty? and open_ids.empty? # and self.facebook_identity.nil?
+    if password.to_s.empty? &amp;&amp; open_ids.empty? &amp;&amp; self.facebook_identity.nil?
       errors.add_to_base( &quot;You didn't choose a password. Please enter a password and try again.&quot;)      
-    elsif open_ids.empty? and (password.to_s != password_confirmation.to_s &amp;&amp; !password_confirmation.nil?)
+    elsif open_ids.empty? &amp;&amp; self.facebook_identity.nil? &amp;&amp; (password.to_s != password_confirmation.to_s &amp;&amp; !password_confirmation.nil?)
       errors.add_to_base( &quot;Your password and confirmation did not match. Please re-enter them and try again.&quot;)      
     end    
   end</diff>
      <filename>app/models/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,12 @@
 &lt;%= stylesheet_link_tag :defaults, :cache =&gt; true %&gt;
 &lt;%= javascript_include_tag :defaults, :cache =&gt; true %&gt;
 &lt;%= javascript_include_tag( @page_specific_js, :cache =&gt; 'page_specific' ) if @page_specific_js %&gt;
-			
+
+&lt;% if facebook_session -%&gt;
+&lt;%= fb_connect_javascript_tag %&gt;
+&lt;%= init_fb_connect [&quot;XFBML&quot;], &quot;{\&quot;ifUserNotConnected\&quot;:\&quot;/login\&quot;}&quot; %&gt;
+&lt;% end -%&gt;
+
 &lt;%= yield :head %&gt;
 
 &lt;/head&gt;
\ No newline at end of file</diff>
      <filename>app/views/layout_components/_head.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
   &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
-&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
+&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xmlns:fb=&quot;http://www.facebook.com/2008/fbml&quot; &gt;
 
 	&lt;%= render :partial =&gt; &quot;layout_components/head&quot; %&gt;
 </diff>
      <filename>app/views/layouts/basic.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
   &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
-&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
+&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xmlns:fb=&quot;http://www.facebook.com/2008/fbml&quot;&gt;
 
 	&lt;%= render :partial =&gt; &quot;layout_components/head&quot; %&gt;
 </diff>
      <filename>app/views/layouts/full_width.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 &lt;h1&gt;Join Ma.gnolia&lt;/h1&gt;
 
-&lt;% form_tag( third_party_registration_path ) do %&gt;
+&lt;% form_tag( open_id_registration_path ) do %&gt;
 
 &lt;div id='third_party_instructions' style='float: right; width: 450px; border: 1px dashed grey; padding: 1em;'&gt;
 	&lt;p&gt;
@@ -17,7 +17,9 @@
 			:style =&gt; 'margin-left: 3em;', :id =&gt; 'instruction_link' %&gt;
 &lt;/p&gt;
 
-&lt;p&gt;or use your &lt;%= link_to 'Facebook account', root_url %&gt; &lt;/p&gt;
+&lt;%= fb_connect_javascript_tag %&gt;
+&lt;%= init_fb_connect [&quot;XFBML&quot;] %&gt;
+&lt;p&gt;or sign up with Facebook: &lt;span style='position: relative; top: 7.5px;'&gt;&lt;%= fb_login_button 'doFacebookLogin()' %&gt;&lt;/span&gt;&lt;/p&gt;
 &lt;% javascript_tag do -%&gt;
 	$('instruction_link').show();
 	$('third_party_instructions').hide();</diff>
      <filename>app/views/third_party_registrations/new.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,9 @@
 			
 		  &lt;p&gt;&lt;%= f.check_box :remember_me, :style =&gt; 'vertical-align: middle;' %&gt;&lt;%= f.label :remember_me, 'Keep me signed in' %&gt;&lt;/p&gt;
 
+			&lt;%= fb_connect_javascript_tag %&gt;
+			&lt;%= init_fb_connect [&quot;XFBML&quot;] %&gt;
+			&lt;p&gt;You can also sign in with Facebook: &lt;span style='position: relative; top: 7.5px;'&gt;&lt;%= fb_login_button 'doFacebookLogin()' %&gt;&lt;/span&gt;&lt;/p&gt;
 		&lt;% end %&gt;
 
 		&lt;p&gt;Not a member? You can &lt;%= link_to 'Join Free', signup_url %&gt;.&lt;/p&gt;</diff>
      <filename>app/views/user_sessions/new.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -36,7 +36,7 @@ Rails::Initializer.run do |config|
   # config.gem &quot;aws-s3&quot;, :lib =&gt; &quot;aws/s3&quot;
   config.gem 'rubyist-aasm', :lib =&gt; 'aasm'
   config.gem 'ruby-openid', :lib =&gt; 'openid'
-  config.gem 'authlogic'
+  # config.gem 'authlogic'
   
   # Only load the plugins named here, in the order given. By default, all plugins 
   # in vendor/plugins are loaded in alphabetical order.</diff>
      <filename>config/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,15 +7,21 @@ ActionController::Routing::Routes.draw do |map|
   map.resources :users
   map.resource :user_session
   map.resource :third_party_registration
+  map.resource :open_id_registration
   map.resources :user_activations
   map.resources :password_resets
   
+  # facebook application
+  map.resources :seeds, :conditions =&gt; { :canvas =&gt; true } 
+  
 	# ==================
 	# = Administration =
 	# ==================
   # map.namespace :admin do |admin|      
   # end
   
+  map.connect 'connect', :controller =&gt; 'connect', :action =&gt; 'index'
+  
   map.validate_screen_name 'registration/check_screen_name', :controller =&gt; 'ajax_validations', :action =&gt; 'validate_screen_name'
   map.validate_email 'registration/check_email', :controller =&gt; 'ajax_validations', :action =&gt; 'validate_email'
 
@@ -24,5 +30,4 @@ ActionController::Routing::Routes.draw do |map|
   map.orientation 'orientation', :controller =&gt; 'pages', :action =&gt; 'show', :page =&gt; 'orientation'
 	map.root :controller =&gt; 'pages', :action =&gt; 'show', :page =&gt; 'home'
 
-
 end</diff>
      <filename>config/routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,17 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version =&gt; 20081119192750) do
+ActiveRecord::Schema.define(:version =&gt; 20090107200544) do
+
+  create_table &quot;facebook_identities&quot;, :force =&gt; true do |t|
+    t.integer  &quot;facebook_id&quot;
+    t.integer  &quot;user_id&quot;
+    t.datetime &quot;created_at&quot;
+    t.datetime &quot;updated_at&quot;
+  end
+
+  add_index &quot;facebook_identities&quot;, [&quot;facebook_id&quot;], :name =&gt; &quot;index_facebook_identities_on_facebook_id&quot;
+  add_index &quot;facebook_identities&quot;, [&quot;user_id&quot;], :name =&gt; &quot;index_facebook_identities_on_user_id&quot;
 
   create_table &quot;open_id_authentication_associations&quot;, :force =&gt; true do |t|
     t.integer &quot;issued&quot;</diff>
      <filename>db/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 module BeforeFilterRequirements
   
-  LOGGED_IN_ERROR_MESSAGE = 'You must be logged in to access this page.'
-  LOGGED_OUT_ERROR_MESSAGE = 'You must be logged out to access this page.'
+  LOGGED_IN_ERROR_MESSAGE = 'You must be logged in to access the page you requested.'
+  LOGGED_OUT_ERROR_MESSAGE = 'You must be logged out to access the page you requested.'
   
   private
   </diff>
      <filename>lib/before_filter_requirements.rb</filename>
    </modified>
    <modified>
      <diff>@@ -711,6 +711,9 @@ Object.extend(Object.extend(Magnolia.Bookmark.prototype, Blueprint.Basic), {
   }
 });
 
+// ===========================
+// = Registration Validation =
+// ===========================
 
 function checkScreenName(name, element, token){
   $(element).update(&quot;&lt;img src=\&quot;/images/chrome/spinner_on_b.gif\&quot; class=\&quot;status_icon\&quot; /&gt; Checking...&quot;);
@@ -731,3 +734,13 @@ function checkPasswords(element) {
     element.update(&quot;&lt;img src=\&quot;/images/icons/green_accept.gif\&quot; class=\&quot;status_icon\&quot;/&gt; Password verified.&quot;);
   else element.update(&quot;&lt;img src=\&quot;/images/icons/yellow_reject.gif\&quot; class=\&quot;status_icon\&quot;/&gt; Passwords do not match.&quot;);
 }
+
+// ==============================
+// = Facebook Connect Callbacks =
+// ==============================
+
+// called from the login page. just redirects to root. the presence of the facebook connect cookies will 
+// then be detected by the set_facebook_session and load_user before_filters
+function doFacebookLogin() {
+  window.location=&quot;/&quot;;
+}</diff>
      <filename>public/javascripts/application.js</filename>
    </modified>
    <modified>
      <diff>@@ -24,118 +24,6 @@ describe ThirdPartyRegistrationsController do
 
   end
   
-  describe &quot;responding to POST create&quot; do
-    
-    describe &quot;with an open_id_identifier&quot; do
-      
-      describe &quot;which is valid and not an email&quot; do
-        it &quot;should do OpenId authentication&quot; do
-          @controller.should_receive(:using_open_id?).and_return(true)
-          @controller.should_receive(:open_id_authentication)
-          post :create, :openid_identifier =&gt; 'foo.myopenid.com'
-        end
-      end
-      
-      describe &quot;which is an email&quot; do
-        
-        describe &quot;that is already in use&quot; do
-          
-          before(:each) do              
-            @controller.should_receive(:using_open_id?).and_return(false)
-          end
-          
-          it &quot;should return an error message&quot; do
-            User.should_receive(:find_by_email).with('foo@myopenid.com').and_return(mock_user)
-            post :create, :openid_identifier =&gt; 'foo@myopenid.com'
-            flash[:error].should match( /email/ )
-          end
-          
-          it &quot;should re-render the new form&quot; do            
-            User.should_receive(:find_by_email).with('foo@myopenid.com').and_return(mock_user)
-            post :create, :openid_identifier =&gt; 'foo@myopenid.com'
-            response.should render_template('new')
-          end
-        end
-        
-        describe &quot;that is not in use&quot; do
-          
-          it &quot;should try to translate the email to an OpenId&quot; do
-            @controller.should_receive(:get_openid_for_email).with( 'foo@myopenid.com', :use_fallback_service =&gt; false )
-            post :create, :openid_identifier =&gt; 'foo@myopenid.com'
-          end
-          
-          it &quot;should do OpenId authentication if the email could be translated to an OpenId&quot; do
-            @controller.should_receive(:get_openid_for_email).and_return('foo.myopenid.com')
-            @controller.should_receive(:open_id_authentication)
-            post :create, :openid_identifier =&gt; 'foo@myopenid.com'
-          end
-          
-          it &quot;should redirect to un/pw registration if the email could NOT be translated to an OpenId&quot; do
-            @controller.should_receive(:get_openid_for_email).and_return(nil)
-            post :create, :openid_identifier =&gt; 'foo@myopenid.com'
-            response.should redirect_to(new_user_path)
-          end 
-        end
-        
-      end # with email
-    end # with openid_identifier
-    
-    describe &quot;with OpenId complete callback&quot; do
-      
-      describe &quot;successful&quot; do
-        
-        before(:each) do
-          result = mock_model( OpenIdAuthentication::Result, { :successful? =&gt; true, :message =&gt; 'pass' } )
-          sreg = mock_model( OpenID::SReg::Request )
-          sreg.stub!(:[]).with( 'email' ).and_return( 'foo@myopenid.com' )
-          sreg.stub!(:[]).with( 'nickname' ).and_return( 'foo' )
-          @controller.should_receive(:authenticate_with_open_id).with(
-              'foo.myopenid.com', 
-              :required =&gt; [ :email ], 
-              :optional =&gt; [ :nickname ]
-              ).and_yield( result, 'foo.myopenid.com', sreg )
-        end
-        
-        describe &quot;but OpenId is already in use&quot; do
-          
-          before(:each) do
-            User.should_receive( :find_by_open_id ).with( 'foo.myopenid.com' ).and_return( mock_user )
-          end
-          
-          it &quot;should alert user that OpenId is in use&quot; do
-            post :create, :openid_identifier =&gt; 'foo.myopenid.com'
-            flash[:error].should match( /in use/ )
-          end
-          
-          it &quot;should re-render to the new page&quot; do
-            post :create, :openid_identifier =&gt; 'foo.myopenid.com'
-            response.should render_template( 'new' )
-          end
-          
-        end
-        
-        describe &quot;and OpenId is not in use&quot; do
-          
-          before(:each) do
-            User.should_receive( :find_by_open_id ).with( 'foo.myopenid.com' ).and_return( nil )
-          end
-          
-          it &quot;should set the openid_identifier in the session&quot; do            
-            post :create, :openid_identifier =&gt; 'foo.myopenid.com'
-            @controller.session[:openid_identifier].should ==('foo.myopenid.com')
-          end
-          
-          it &quot;should redirect to edit action with user params&quot; do
-            post :create, :openid_identifier =&gt; 'foo.myopenid.com'
-            response.should redirect_to( edit_third_party_registration_url( :user =&gt; { :screen_name =&gt; 'foo', :email =&gt; 'foo@myopenid.com' } ) )            
-          end
-        end
-      
-      end # successful
-    end # with OpenId complete callback
-    
-  end # POST create
-  
   describe &quot;responding to PUT update&quot; do
     
     describe &quot;without an authenticated openid_identifier&quot; do</diff>
      <filename>spec/controllers/third_party_registrations_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,11 @@
 # == Schema Information
-# Schema version: 20081119192750
+# Schema version: 20090107200544
 #
 # Table name: users
 #
 #  id                    :integer(4)      not null, primary key
 #  screen_name           :string(50)
+#  first_name            :string(50)
 #  email                 :string(255)
 #  crypted_password      :string(255)
 #  password_salt         :string(255)</diff>
      <filename>spec/fixtures/users.yml</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ module BeforeFilterSpecHelper
   
   # Returns an Array containing the actions for the current controller to which the given filter has been applied
   def get_actions_to_test(filter_method)
-    
+
     current_filter = controller.class.filter_chain.detect do |f| 
       f.kind_of?( ActionController::Filters::BeforeFilter ) &amp;&amp; f.method == filter_method 
     end</diff>
      <filename>spec/spec_helpers/before_filter_spec_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ module Authlogic
         # without establishing a DB connection. In your framework environment this is done for you, but if you are using Authlogic outside of your frameword, you need to assign a controller
         # object to Authlogic via Authlogic::Session::Base.controller = obj.
         def activated?
-          !controller.blank?
+          !controller.nil?
         end
         
         def controller=(value) # :nodoc:</diff>
      <filename>vendor/plugins/authlogic/lib/authlogic/session/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,11 +7,16 @@ module Facebooker
           javascript_include_tag &quot;http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php&quot;
         end
         
-        def init_fb_connect(*required_features)
-          init_string = &quot;FB.Facebook.init('#{Facebooker.api_key}','/xd_receiver.html');&quot;
+        # See: http://wiki.developers.facebook.com/index.php/JS_API_M_FB.Facebook.Init_2
+        # See: http://wiki.developers.facebook.com/index.php/JS_API_M_FB.Bootstrap.requireFeatures
+        # - required_features: an array of strings for the Facebook Features to be loaded by the FB JS API
+        # - app_settings: Needs to be a string containing a json hash. 
+        # We can't use to_json for the app_settings because that would prevent passing in callback method references...
+        def init_fb_connect(required_features = ['Api'], app_settings = '{}')
+          init_string = &quot;FB.Facebook.init('#{Facebooker.api_key}', '/xd_receiver.html', #{app_settings});&quot;
           unless required_features.blank?
              init_string = &lt;&lt;-FBML
-              Element.observe(window,'load', function() {
+              Element.observe(window, 'load', function() {
                 FB_RequireFeatures(#{required_features.to_json}, function() {
                   #{init_string}
                 });</diff>
      <filename>vendor/plugins/facebooker/lib/facebooker/rails/helpers/fb_connect.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>app/helpers/open_id_registration_helper.rb</filename>
    </removed>
    <removed>
      <filename>app/views/third_party_registrations/error.html.erb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>88125f407d153927afd469c19b16fd5d779d0af3</id>
    </parent>
  </parents>
  <author>
    <name>Jesse Clark</name>
    <email>jesse@jesseclark.com</email>
  </author>
  <url>http://github.com/magnolia/magnolia/commit/8ff89bfdbcd86817106800cc70e1782ca0b53065</url>
  <id>8ff89bfdbcd86817106800cc70e1782ca0b53065</id>
  <committed-date>2009-01-19T12:45:12-08:00</committed-date>
  <authored-date>2009-01-19T12:45:12-08:00</authored-date>
  <message>facebook connect implemented</message>
  <tree>483d9e0be25c23d86d398bf11b767cf0d44b65a9</tree>
  <committer>
    <name>Jesse Clark</name>
    <email>jesse@jesseclark.com</email>
  </committer>
</commit>
