Recent Thoughts

Just got some new specs, and man, what a beautiful world I've been missing! lol

2 days, 19 hours ago

Facebook Plugin v2.0 released -- Graph System! http://is.gd/dxPr4 (Special thanks to @travisrowland) #cakephp

1 week, 5 days ago

>> More Tweets...

Downloads

Contact Us

Email:
Topic:
Message:

Google Ad

CakePHP Facebook Plugin -- Auth+Facebook and more

Date: Tue, Feb 9th 2010, 06:44 Author: nick Views: 7098 Comments: 62 share

CakePHP Facebook Plugin

Info:
Get it:
  • Download Now
  • svn co http://svn.github.com/webtechnick/CakePHP-Facebook-Plugin facebook
The purpose of the Facebook plugin is to provide a seamless way to connect your cakePHP app to everyone's favorite social networking site -- Facebook. The goal for this plugin is to not only provide extremely useful dynamic features but to also provide a complete interface to the Facebook API.

This plugin is specifically for CakePHP 1.3

Example App: http://facebook.webtechnick.com
Example App Source: http://svn.xp-dev.com/svn/facebook_example_app/

Version 2.0 Update (Graph System):
http://www.webtechnick.com/wtn/blogs/view/238/Facebook_Plugin_v2_0_Graph_System


Feature List


  • Full featured authentication via Facebook Connect. Facebook Authentication will work with or without a user login system already in place on your site. Works seamlessly with your already built in user authentication system via AuthComponent -OR- Facebook Connect can work as your primary authentication system.
    • Setup is as easy as dropping Facebook.Connect into your components array.
    • Retrieve Detailed User Information and gain access to protected data via extended permissions (user prompted to allowed)

  • Easily create dynamic and customizable Facebook content
    • Share (let your users share what they find on your site with their friends)
    • Like (let your users like what they find on your site with their friends)
    • Login/Logout (Facebook users can login and logout of your site with a single click.. no registration required)
    • Activity Feed (Display your application's and friends activity)
    • Friend Pile (Display your application's friends)
    • Recommendations (Display your recommendations based on your current url)
    • Fan Boxes (Allow users to become facebook fans of your site)
    • Profile Pictures (Display a facebook profile picture)
    • Live Streams (Create dynamic live stream events)
    • Comments (Connect with your users by allowing them to comment on any part of your site through Facebook
    • Status (Display the status of the logged in user)

  • Access to Facebook API anywhere in your app. Build custom content with direct access to the full Facebook API.

  • Everything is included. No need to download the Facebook API files or create Facebook specific files (xd_receiver.htm and the like). Everything is included in the plugin and will be maintained.


Configuration


To get started you'll first need to download and unpack the Facebook Plugin into your app/plugins/facebook directory. If you plan on using any features mentioned above (except the share feature, which will work with no further configuration), you will need to get an api_key and secret from Facebook.

Once you have your api_key, secret, and app_id from Facebook, you'll need to create a configuration file named 'facebook.php' within your app/config directory with this information.

  1. app/config/facebook.php
  2. $config = array(
  3.   'Facebook' => array(
  4.     'appId' => 'YOUR_APP_ID',
  5.     'apiKey' => 'YOUR_API_KEY',
  6.     'secret' => 'YOUR_SECRET',
  7.     'cookie' =>true,
  8.   )
  9. );


Setup


You'll more than likely at least want to use the bundled FacebookHelper.

  1. //app_controller.php
  2. var $helpers = array('Facebook.Facebook');


If all you want to use is the 'share' feature skip ahead to Usage Examples as there is no further setup required for 'share' to work. However, if you wish to use some of the more advanced features you will need to alter your layout a little to accommodate the fbxml (facebook-xml).

Alter your views/layouts/default.ctp


Replace:
  1. <html>

with
  1. <?= $facebook->html(); ?>


Add at bottom of your page:
  1. <?= $facebook->init(); ?>


Your layout should look something like this:
  1. <?= $facebook->html(); ?>
  2.   <head>
  3.     <title>Facebook Plugin Example</title>
  4.   </head>
  5.   <body>
  6.     <?php echo $content_for_layout ?>
  7.     <?= $facebook->init(); ?>
  8.   </body>
  9. </html>


Now you're ready to start using the more advanced features included in the Facebook plugin.

Extended Permissions


UPDATE: Facebook.Connect now uses the new graph system. Extended permissions are now asked on the fly.

Usage Examples


The Plugin comes with a whole slew of neat dynamic content from Facebook.

Share feature:
  1. //Create a share button
  2. $facebook->share(); //defaults to current page
  3.  
  4. //Share button with a different url
  5. $facebook->share('http://www.webtechnick.com');
  6.  
  7. //Share button with url and options
  8. $facebook->share('http://www.webtechnick.com', array('style' => 'link', 'label' => 'Check it out!'));
  9.  
  10. //Like button with url and options
  11. $facebook->like();
  12.  
  13. //Like button with options
  14. $facebook->like(array(
  15.   'font' => 'veranda',
  16.   'layout' => 'button_count',
  17.   'action' => 'recommend',
  18.   'colorscheme' => 'dark'));


Fanbox feature (app_id required):
  1. //Display Fan Box with minimal options
  2. $facebook->fanbox();
  3.  
  4. //Display fanbox with all the whistles and bells
  5. $facebook->fanbox(array('stream' => true, 'logobar' => true, 'connections' => true));


Live Stream feature:
  1. //Display livestream event
  2. $facebook->livestream();
  3.  
  4. //Display livestream event with all whistles and bells
  5. $facebook->livestream(array('width' => '300', 'height' => '500', 'xid' => 'YOUR_EVENT_XID', 'event_app_id' => 'CUSTOM_APP_ID'));


Comments feature:
  1. //Display comments section
  2. $facebook->comments();
  3.  
  4. //Display comments with all whistles and bells
  5. $facebook->comments(array('width' => '300', 'height' => '500'));


Profile Pictures feature:
  1. //Display picture of facebook user
  2. $facebook->picture($facebook_id);
  3.  
  4. /** Hint: if you're using the Facebook.Connect feature, set the Auth->user() to a variable and use that to show the logged in user's profile
  5. */
  6. $facebook->picture($user['User']['facebook_id']);
  7.  
  8. //Display picture of facebook user with all a size
  9. //options: thumb, small, normal, square (default thumb)
  10. $facebook->picture($facebook_id, array('size' => 'normal'));
  11.  
  12. //Or set your own size
  13. $facebook->picture($facebook_id, array('width' => '200', 'height' => '200'));
  14.  
  15. //Show a generic facebook logo until the picture is loaded
  16. $facebook->picture($facebook_id, array('facebook-logo' => true));


Recommendations:
  1. //Display Facebook Recommendations based on the current page
  2. $facebook->recommendations();
  3.  
  4. //Recommendations with some whistles and bells
  5. $facebook->recommendations(array(
  6.   'colorscheme' => 'dark',
  7.   'bordercolor' => 'black',
  8.   'width' => '100',
  9.   'height' => '100',
  10.   'header' => 'false'));


Facebook Connect (Authentication)


You can use the Facebook Plugin as your primary user authentication system or along side your current authentication system (currently only supports CakePHP's AuthComponent).

Setup is extremely simple. Just drop in Facebook.Connect into your app_controller's components array.
  1. //app_controller.php
  2. var $components = array('Auth', 'Facebook.Connect');


And add facebook_id to your user table (or the table you use for your Auth Component).
  1. ALTER TABLE `users` ADD `facebook_id` BIGINT UNSIGNED NOT NULL


That's it! You're now ready to accept Facebook Login/Logout with your Authentication system.

Login Buttons
To add a Facebook Connect login button use:
  1. //Display login button medium size button
  2. $facebook->login();
  3.  
  4. //Display a small button
  5. //options: small, medium, large, or xlarge
  6. $facebook->login(array('size' => 'small'));
  7.  
  8. //Display a login button with a different background
  9. //options: white, dark, light (default light)
  10. $facebook->login(array('background' => 'dark'));


Logout Buttons
To add a Facebook Connect logout button use:
  1. //Display a logout button medium size
  2. $facebook->logout();
  3.  
  4. //Display a logout button small size
  5. $facebook->logout(array('size' => 'small'));
  6.  
  7. //Display a logout link with a redirect
  8. //label is 'logout' by default.
  9. $facebook->logout(array('redirect' => 'users/logout', 'label' => 'Sign Out'));
  10.  
  11. $facebook->logout(array(
  12.   'redirect' => array('controller' => 'users', 'action' => 'logout'),
  13.   'label' => 'Sign Out'));


If you already have a built in Authentication system you will need to redirect to your apps logout action. Do this by adding a redirect to the logout button.
  1. //Logout from facebook and then redirect to logout from app
  2. //NOTE: redirect can be CakePHP array based url
  3. $facebook->logout(array('redirect' => 'users/logout'));
  4.  
  5. //Change logout text ('logout' by default)
  6. $facebook->logout(array('redirect' => 'users/logout', 'label' => 'Sign Out'));


Facebook Connect User Information


While using the Facebook.Connect you can obtain more detailed information about your logged in user via the user() function. The result will return an array of useful information for your user. By default, only last_name, first_name, and email are returned. However, you can request anything you want that is an available option via facebook API: http://wiki.developers.facebook.com/index.php/Users.getInfo#Response

Example:
  1. var $components = array('Auth','Facebook.Connect');
  2.  
  3. function beforeFilter(){
  4.   //Get all the details on the facebook user
  5.   $this->set('facebookUser', $this->Connect->user());
  6.  
  7.   //retrieve only the id from the facebook user
  8.   $this->set('facebook_id', $this->Connect->user('id'));
  9.  
  10.   //retrieve only the email from the facebook user
  11.   $this->set('facebook_email', $this->Connect->user('email'));
  12. }



Full Facebook API access


Access the Facebook API by importing Facebook.FB anywhere in your app then calling it to do various custom things. Depending on what version of PHP you're running you can make requests in a number of ways.

  1. App::import('Lib', 'Facebook.FB');
  2.  
  3. //PHP 5.3
  4. FB::api('/me'); //graph system call to /me
  5.  
  6. //PHP < 5.3
  7. $FacebookApi = new FB();
  8. $FacebookApi->api('/me');


The reason for the difference is the introduction of __callstatic() in PHP 5.3 that prior to 5.3 there's no way to overwrite the _call of a static method.

Take a look at all the available options and features you can use via the Facebook API here http://wiki.developers.facebook.com/index.php/Main_Page

If you have a feature request post a comment!

Enjoy


I hope you enjoy the work I put into this plugin. I encourage you to look at the API documentation for an in-depth look at all the available options for each feature.

As always, if you like the plugin, find a bug, or have a feature request post a comment. =) If you really like the plugin and want to help keep it maintained please consider a donation. It really does help!

Thanks,
Nick

Comments

02/10/2010 11:03 am

here is cakephp plugin im waiting for

here is the cakephp plugin im waiting for after twitter datasources, thanks for creating this plugin.
02/11/2010 12:40 am

Facebook Example App

Just added a facebook example app showcasing all the features of the plugin:

http://facebook.webtechnick.com
02/17/2010 7:31 am

Version 1.4.0 Update

I've updated the article to include my new 1.4.0 changes which include a new getUserInfo() function for Facebook.Connect and an easier way to access the FacebookAPI from anywhere in your app (not just controllers).
02/18/2010 8:42 pm

Version 1.5.2 Update

I've updated the article to include the new changes in 1.5. Included in this release are the new extended permissions and better facebook user retrieval methods.
03/03/2010 5:33 am

Version 1.5.4 Update

Bug fixes and new facebook status feature.
03/07/2010 6:49 am

facebook.php not found

Hi, thank you for this plugin, if I can get it working, it should help solve a lot of my problems.

I've followed the instructions up until the point where you need to add the line to the footer of your page, but I'm getting an error show up saying:


Login
Enter your details
Username:
Password:
Login Register for free
No Facebook.api_key detected. Please add Configure::write('Facebook.api_key', YOUR_API_KEY_HERE) somewhere in your application.

I'm assuming this is because the plugin isn't finding the facebook.php file in the /app/config folder, but I don't know how to make it do this.

I don't know if this makes any difference or not, but I'm using Cake 1.3. Thank you.
03/07/2010 6:50 am

whoops

Sorry, kinds messed up a copy/paste just then, the error should only say:

No Facebook.api_key detected. Please add Configure::write('Facebook.api_key', YOUR_API_KEY_HERE) somewhere in your application.

Thanks
03/07/2010 7:40 am

1.5.5 fixes that issue.

The FacebookHelper was unintentionally dependent on the Connect Component to be loaded first. As such, the api_key configuration file was loaded by the component and not the helper (ie not loading twice). v1.5.5 fixes this issue by checking first if api_key is cached, if not attempt to load the configuration file, cache it and set the key. This ensures the configuration file will only be loaded once with or without the component.

Thanks for catching that,
Nick
03/07/2010 7:48 am

Thank you

Thank you for this plugin... It seems like it's going to be very powerful, and I did manage to get a few bits for it working once I loaded the connect helper - but I think at the moment it's a bit more advanced than I need.

I'm going to spend some more time developing my site locally, getting my own auth system in place, and then look into adding this to it.

Thank you so much for this however, I look forward to using it fully soon :)
03/13/2010 11:07 pm

Helper

For some reason using 1.3RC1 the Facebook helper isnt creating the login buttons, etc. Any idea if something was updated on the API or if anyone else is having this problem? If I manually include the scripts and call the XFBML it works, but not using the helpers. The api calls work great though, so I'm not sure what's going on. Any help would be great.
03/14/2010 12:30 am

I'm using the latest 1.3 from github

I'm using the latest 1.3 from github and I'm not having any problem with the helper. The example app http://facebook.webtechnick.com is running on the latest 1.3 without issue.

Can you describe what isn't working? Is nothing being outputted? What does your layout look like? Does any of the helper function work? How are you calling the helper? What have you tried to debug it?
03/14/2010 11:25 am

Session error

Hi,
Great plugin but I get this error when resuming a session.

Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Session key invalid or no longer valid' in /var/www/vhosts/mysite.com/httpdocs/cake/app/plugins/facebook/vendors/facebook/php/facebookapi_php5_restlib.php:3065 Stack trace: #0 /var/www/vhosts/mysite.com/httpdocs/cake/app/plugins/facebook/vendors/facebook/php/facebookapi_php5_restlib.php(1717): FacebookRestClient->call_method('facebook.users....', Array) #1 /var/www/vhosts/mysite.com/httpdocs/cake/app/plugins/facebook/controllers/components/connect.php(72): FacebookRestClient->users_getInfo('610926696', Array) #2 /var/www/vhosts/mysite.com/httpdocs/cake/app/plugins/facebook/controllers/components/connect.php(119): ConnectComponent->getUserInfo(Array) #3 /var/www/vhosts/mysite.com/httpdocs/cake/app/plugins/facebook/controllers/components/connect.php(58): ConnectComponent->_handleFacebookUser() #4 /var/www/vhosts/mysite.com/httpdocs/cake/cake/libs/controller/component.php(98): ConnectComponent->initialize(Object(EventsController), Array) #5 /va in /var/www/vhosts/mysite.com/httpdocs/cake/app/plugins/facebook/vendors/facebook/php/facebookapi_php5_restlib.php on line 3065
03/14/2010 4:31 pm

Exception error fixed in 1.5.5

That error happens with a corrupt Facebook session/cookie. The Facebook documentation tells us to try-catch it and clear the Facebook session if caught. I have done so in the latest release (v1.5.5). Upgrading your plugin should resolve the issue. Please verify the version of your plugin with:

  1. debug(FacebookInfo::version());


Hope that helps,
Nick
03/20/2010 10:56 pm

thanks so much

This plugin is looking great. Is it supposed to autosave the user's facebook_id? I am using the standard cake auth component, and followed your steps outlined here. Put in a connect button on my user's settings page (so they have to be logged in with auth component at this point). After clicking the FB connect button, i get the popup.. click next etc. and it reloads the page.

however A) is stored in my users.facebook_id for that auth'd user
but B) $this->Connect->getUserInfo() in the controller returns the correct authd user. I assume it's using the cookie facebook stores.

Can you help me out with this?
03/20/2010 10:57 pm

edit

i meant to say.. A) *NOTHING* is stored in my users.facebook_id..
03/21/2010 2:05 am

What's the order of your components?

To have the Facebook.Connect have a successful save in your Auth's user table it needs to know what Auth User model you're using. It does this by itself, but only if you have Facebook.Connect *after* your Auth in your components array.

  1. var $components = array('Auth', 'Facebook.Connect');


Otherwise Facebook.Connect assumes you're not using the Auth component and are using Facebook.Connect as your primary authentication system (ie no save/update is attempted).

Hope that helps,
Nick
03/21/2010 2:14 am

facebook_id only saved if its a new user

I missed something in your last comment. You mentioned you have the facebook Connect button *After* the user is already authenticated (ie has a user record).

The facebook_id is only saved to the user table if it's a new record, it won't update an already created user record.

I envisioned if a user decided to use Facebook.Connect they would have to continue to use that for future logins. I imagine it would be nice to have the option to do either your basic Auth login OR Facebook.Connect.

I'll add that as a feature in the next release.

Thanks for the suggestion,
Nick
03/21/2010 2:35 am

Version 1.6 update

Newest version 1.6 released. Facebook.Connect will now update a user table if the user exists, but has an empty facebook_id during a Facebook.Connect login. This is useful for when a user has already registered using CakePHP's Auth component, but would also like the option to login via Facebook.Connect at a later time.

Let me know if you have any issues, and thanks for the feature request,
Nick
03/21/2010 12:50 pm

more.

Cool, thanks for the quick response. I've been reading your code and learning quite a bit.
Given your 1.6 update:
I actually changed it so in connect.php, additionally check for $Auth->user instead of !$Auth->user (since i am allready logged in, it wasn't falling into this if statement)
and changed $user to search the User model by the ID specified by the Auth component (since facebook_id is null at this point).

Also, to my taste: I made it so that the plugin doesn't overwrite the Auth component username field. It was preventing me from being able to logout

thanks for your help with this plugin.
04/08/2010 12:40 pm

download contains svn directories

Probably not a major deal generally, but the project im working on is already in svn control, so im unable to add your plugin to my projects svn repository. Not a major deal, i can remove the .svn directories or checkout your source directly, but as someone else mentioned, i to will need to make a few modifications to make it work as desired within my project, so i'd prefer to keep it under my svn control. its an easy fix but wanted to let you know so that maybe the download link could not have the svn directories since we get that from the svn checkout link.

for anyone who did need to remove it on *nix you can

find . -type -d -name .svn -exec rm -rf {} \;

from within the facebook plugin directory


Thanks, i cant tell you how much i love this plugin.
04/12/2010 11:31 pm

findByFacebookId()

I'm having problems with new user records being created when they sign in and getting facebook_ids to be auto-magically updated and created -- I'm using the latest Cake from GIT and latest version of your plugin from SVN.

In looking through your code I can see what looks to be a "fat model" style call to findByFacebookId() in _handleFacebookUser() in the ConnectComponent class which I can't actually locate anywhere even with a recursive grep.

Am I missing the point here?

N
04/13/2010 1:51 am

findBy___ is a function given to you by CakePHP

This is one of the cool features of CakePHP (and PHP in general).

You can read about it here:
http://book.cakephp.org/view/451/findBy

Hope that helps,
Nick
04/19/2010 2:24 am

Auth problem

I try this plugin and look fabolous, but often my app lose authentication and i can't find how to manage. I use cake 1.3rc4 and implemente fb connect and fb api on php5.2 server
04/21/2010 7:04 am

logging in but pop up window doesnt close

nice plugin but i face a small problem...
my pop-up window doesnt close after authentication...instead my connect url is displayed in this child window while parent window remains unchanged....am i missing something here? help would be greatly appreciated....
04/21/2010 7:31 am

logging issue (contd.)

the way it should be is after authentication the child window should close and control should transfer to parent window right? but here, the parent window remains as it is while the child window displays the page after login....a point to note is login is done successfully....
04/21/2010 12:21 pm

Indeed, you are correct

Yes, the child window should close and the parent window should reload. This is the way it works on http://facebook.webtechnick.com. I'm not sure why it wouldn't work like that for you.

Are you using the helper for your login button? Make sure you don't overwrite the onlogin key as it sets 'window.location.reload()' as its return function by default.

Hope that helps,
Nick
04/21/2010 1:14 pm

Facebook connect discontinued

Bad news and a real pitty for all the hard work that has been put into this project, I really love.

http://mashable.com/2010/04/21/facebook-kills-facebook-connect/
04/21/2010 2:04 pm

Indeed, just read the news

Yes, indeed, I just recently heard the news myself.

Good news is the graph API looks extremely powerful and less "spammy" to the user who needs certain permissions from the facebook user (which is a great change, it was always a pain to obtain permissions from the user to retrieve or do certain things).

In regards to this project, there is no need to worry. I will be maintaining the plugin through the transition. It is possible I will fork the project and refactor so that I could include any other OAuth enabled service (twitter, etc..), but either way, I will keep everyone who currently uses this plugin informed via this site.
04/21/2010 10:54 pm

what do i write in the helpers array?

only form or something extra to include?
04/21/2010 11:46 pm

i put the helpers for form

still the same error
04/22/2010 6:48 am

i dint get you clearly...

please could you explain a bit more? i am a noob in this...
04/22/2010 3:45 pm

Need more information...

I'm not sure what you're asking. Please be specific. What is the problem? What have you tried? What errors have you gotten?
04/22/2010 10:43 pm

logged into pop-up window

my issue in detail
once the facebook connect is clicked a pop-up window opens...i login with my facebook credentials....i get logged into my website, i.e. correct login occurs but in the pop-up window only....i am expecting the child window to close and my parent window to show my website after login...
04/27/2010 9:38 pm

HtmlHelper::script Error

Hi Nick,

Warning (512): Method HtmlHelper::script does not exist [CORE/cake/libs/view/helper.php, line 143]

Sorry I've only been using cakephp for a few months so I'm still getting used to it. Do you have any idea why this error would occur? It seemed to be coming from ..

Helper::call__() - CORE/cake/libs/view/helper.php, line 143
Overloadable::__call() - CORE/cake/libs/overloadable_php5.php, line 52
HtmlHelper::script() - [internal], line ??
FacebookHelper::loader() - APP/plugins/facebook/views/helpers/facebook.php, line 299
include - APP/views/layouts/default.ctp, line 23

Line 299 of facebook.php:

return $this->Html->script($this->_fbFeatureLoaderScript . $locale['locale'], $options);


Thanks!
Andrew

p.s. Your plugin rocks. Just cause Facebook Connect is being killed doesn't mean it's stopped just yet!!!
04/27/2010 10:55 pm

Facebook Plugin requires the CakePHP 1.3

Hi Andrew,

Thanks for the compliments. The error you're running into is due to you trying to get this plugin to run in cakephp 1.2.x. The plugin requires cakephp 1.3. That HtmlHelper::script is new in 1.3. Make sure you're using the latest version of CakePHP.

Hope that helps,
Nick
05/01/2010 5:32 pm

Gigya & Anticipated Date?

I was just about to attempt this with cakePHP 1.3 so this is a great head start! Have you considered instead though to wrap it around a service like gigya instead and then you'd only have to update any functions related to gigya while letting gigya update each of the individual third-party sites?

Any anticipated date on completion for the Open Graph API?
05/04/2010 8:55 am

Working in 1.2

Just thought i'd mentioned it only required me to modify like 3 lines of code to get this to work in 1.2. Just read up on the changes from 1.2 to 1.3 and reverse the helper calls he used to their old state. Unless i missed something else, so far everything has worked perfectly .
05/04/2010 10:09 pm

Graph ETA + Gigya

It's funny you should mention Gigya, I'm actually writing a plugin based on Gigya right now. I've finished the datasource for the new graph system and am currently working on the helper and component to go along with it. I will definitely be finished with the Graph system before Facebook officially kills Connect.

@Facebook Plugin in 1.2
There is no doubt its possible to port to 1.2, and I'm glad you got it working the way you want. However I still suggest upgrading to 1.3, its stable now, and awesome. In fact, if they bottled CakePHP 1.3 and sold it in grocery stores, they would label it AwesomeSauce. :)
05/12/2010 8:02 am

Comments integration

Is it beyond the scope of this plugin to integrate an existing comments section built using cakephp and facebooks? I've been trying to find a way to do so and so far, it seems like facebook comments is kinda an all or nothing comments box, but i've seen it integrated into wordpress where you can post either with a facebook id OR a wordpress login. I'm assuming it is, but do you know where i might find some documentation on that? I've been googling for about an hour with no luck.
05/12/2010 11:58 am

@Comment integration

It's possible to integrate the comments with facebook comments, but I haven't tried with this plugin or otherwise. It is not beyond the scope, as you have full API access with this plugin, but it may or not be handed to you like many of the other features supported in this plugin.

The comments helper does take in many other options as specified by http://wiki.developers.facebook.com/index.php/Fb:comments_%28XFBML%29

Off the top of my head, I might do something like preform a javascript call that catches the submit button, decides and depending on a flag the user selects submit the form to the appropriate place. But again, that's just off the top of my head and might not be what you want.

I hope that at least helps point you in the right direction,
Nick
05/14/2010 10:18 am

Fanbox - Number of people

Hello,
first, thank you for this great plugin

second, just a little tip that wasn't initially obvious for me, maybe it can be useful for others.
About:
$facebook->fanbox(array('stream' => true, 'logobar' => true, 'connections' => true));

the 'connections' parameter accepts the number of avatars to display in the box; true is translated to 1.
Set
'connections' => 10
(or whatever you like, where whatever < 100)

to display 10 (/ whatever) fans.

Stefano
05/18/2010 2:33 am

Fanbox stopped working on firefox 3.6.3?

It doesn't seem a problem of the plugin.
Is maybe something that breaks it in my page? yesterday it was fine, now it shows only a blank box.

Same problem in the demo, it seems:
http://facebook.webtechnick.com/fanbox />
i don't get why, the javascript seems fine, it works on IE8
05/18/2010 3:08 am

small update on empty fax box

Uhm, no - it isn't related to the browser.

The problem only happens if a logged in user info box (using the facebook connect plugin feature) is on the same page.

05/18/2010 6:59 am

ok, last update - it seems a facebook problem

Same problem in the widget test tools on facebook.com and everywhere.

See
http://developers.facebook.com/blog/post/262 />
i get the fan box only when logged out of facebook.
05/19/2010 9:20 am

Awesome plugin

Tried it.. love it.. but would love to use the open graph... get the access token.. Thanx for amazing plugin.. so simple and powerful...

great job!
05/19/2010 7:46 pm

Fanbox works fine for me loggedin or out

@Stefano: Fanbox seems to work well for me on all the links you provided with me logged in our out of facebook connect. I'm using Chrome Browser, I'll be sure to run it through the browser gauntlet but first tests seem positive. Thank you for the feedback though.

@Graph, Graph is coming soon, very soon. Look forward to a new post coming in the next few days.

05/20/2010 1:25 am

resolved

Yes, it's ok for me too now - I don't know if it was a temporary problem with facebook; or my problem; or i was drunk.

Sorry for the false warning :)

I'll try to track it down if it happens again.

I'm looking forward for graph too!

05/20/2010 10:48 am

Friends

Great work, thanks a lot!

One question:
How can I access the friends of the logged in user?
05/20/2010 5:39 pm

Friends

You can access friends with this plugin in its current state by using the FacebookAPI utility class.

In the next release I will be giving you all a way to access the graph system and in that system you have a whole slew of things you can do easier than using the FacebookAPI class.

I have some final tests for the new graph system and I'll make it public. I think you'll be pleased with what I've come up with.

Hope all is well,
Nick
05/21/2010 2:26 am

New release

Thanks a lot for your quick response, Nick!

I am very excited to hear about your further effort to update your plugin to connect to Facebooks social graph! I can't wait for the new release :-)

If you need beta tester - here I am :-)

Thanks again!
05/26/2010 2:15 pm

Hi, Problem using Login button plz help.

Hi everybody,

I am trying to build my first cakephp app with cake1.3, I want set up simple facebook connect.. I want first name and user's id.. I dont know how to retrieve the user data after i create the login button.

Please help me.

Carol
05/27/2010 7:41 am

email no longer available?

I'm having a hard time pulling the user's email address. And actually, it isn't working in the demo app either.

The problem might be that I don't understand the extended permissions example -- into what file should I add $facebook->init(...?
05/27/2010 12:20 pm

fixed!

Ok, so if you want email or other extended permissions, you need to modify the $facebook->init(); bit at the end of your layout. RTFM.
05/28/2010 4:59 am

@Carol please read the documentation

Hi Carol,

Please read the documentation on how to retrieve user data after a valid facebook connect. The method you'll want to use is $this->Facebook->userData(); in a controller.

For everyone else, I've made the example app: http://facebook.webtechnick.com available to the public via svn.

http://svn.xp-dev.com/svn/facebook_example_app/

Feel free to browse the source to give you an idea of how it all works.

Hope that helps,
Nick
05/28/2010 4:24 pm

Just released Gigya Plugin

Just released the beta version of Gigya Plugin. A CakePHP Plugin that integrates seemlessly with Gigya Social Networking. Allowing you to connect your users to their favoriate social network, single-click registration as well as some other really cool features.

Gigya works with all major social networks including: Facebook, Twitter, Google, Linkedin, OpenID, Myspace, and many more...

Read more about it now: http://www.webtechnick.com/blogs/view/235/Gigya_Social_Network_CakePHP_Plugin

Thank you all for your support!
06/21/2010 8:46 am

iPad

Anyone tried getting this to work on the iPad? It seems to almost work -- the only problem is that the xd_receiver.htm stays open, as a blank page.
07/19/2010 2:40 am

Version 2.0 Update

Version 2.0 Release -- New Graph System!

Read about it here:
http://www.webtechnick.com/wtn/blogs/view/238/Facebook_Plugin_v2_0_Graph_System

Enjoy,
Nick
07/22/2010 6:54 pm

Error

First off, great plugin!!! However, I have a problem. I am going thru the steps to install and am receiving the following error.

"Facebook configuration detected. Please add the facebook configuration file to your config folder."

The configuration file is present as /app/config/facebook.php

Please let me know if you don't mind.

Thanks.

JM

07/22/2010 7:07 pm

Error

Disregard the last error comment. I solved the issue by adding 'Facebook.Connect' to the $components var
07/22/2010 10:06 pm

Version 2.0.2 fixes that issue.

Version 2.0.2 fixes this issue. All configuration settings are now loaded using the new getConfig located in the FacebookInfo class. This will cache the configuration and handle any loading of the configuration file so that it's only ever read in once and from anywhere.
07/30/2010 7:41 am

best way to implement this ...

Thanks for the plugin, I know this is going to make a big difference! The implementation I'm wanting is, if the user is already logged into Facebook they are auto logged in (providing they have given app permission before). Then when they logout of my Auth based system they are out - but not out of Facebook. At the moment when I try and logout of my site using Auth, it won't logout unless Facebook is logged out. Can you give me a pointer as to what to change? I'm learning Cake.
07/30/2010 9:25 am

Check download link

Still download link is pointed to old version and i am getting an error on bottom of the page as "No Facebook configuration detected. Please add the facebook configuration file to your config folder."

Add Comment

Please login or register to submit a comment.