“Facebook connect” Documentation by “Yougapi Technology LLC” v1.2


“Facebook connect”

Created: 12/05/2010
By: Yougapi Technology LLC
Email: contact@yougapi.com

Thank you for purchasing this source code. If you have any questions that are beyond the scope of this help file, please feel free to email us via our page contact form here. Thanks so much!


Table of Contents

  1. Configuration
  2. PHP include and path
  3. Javascript
  4. Facebook class
  5. Credits

A) Configuration - top

You need to define your own Facebook application information in the library.
To do so you need to open the "webzone.php" file situated inside the "include" folder and copy your own values.

Example:
define('FACEBOOK_APP_ID', 'your_own_facebook_app_id');
define('FACEBOOK_SECRET', 'your_own_facebook_app_sectet');


B) PHP include and path - top

You need to define the path to the library (relatively to your current page) and include the "webzone.php" file.

Example:
$path_to_library = 'facebook_connect/';
include($path_to_library.'include/webzone.php');

At that time the library is fully added to your script!


C) JavaScript - top

This Facebook connect library is based on the Facebook Javascript SDK. It need to load some Javascript functions. That is all done via the facebook class included.

You can include the Javascript functions by instantializing the Facebook class, and call the method "loadJsSDK()" with the "$path_to_library" variable that you have previously defined as a parameter.

Example:
$f1 = new Facebook_class();
$f1->loadJsSDK($path_to_library);

Okey at that moment you have the Facebook class loaded from your current page. You just need to call the class methods to integrate what you need.


D) Class methods - top

Your can call the following method to display the "Facebook connect" link to your users:
$f1->displayLoginButton();

If you need to check if the user is already connected to your app or no, call the getCookie() method. If the result returned is empty, that the user is not logged to your application.

Example:
$fb_cookie = $f1->getCookie();
if($fb_cookie!='') { //do what you want since the user is connected }
else { $f1->displayLoginButton(); }

List of some methods you can call for a connected user

$f1->getUserData();
This returns the active Facebook user's data (name, profile URL, picture, etc). You can use the print_r() function to view all available data.

$f1->getFacebookFriends();
This returns the Facebook friends of the current use inside an array.

$f1->displayUsersIcons();
This function receives an array of users (like the array returned by the $f1->getFacebookFriends() method) and can returns a clickable picture of the users with a link to their respective Facebook profile.

$f1->getFacebookAccounts();
This returns the Facebook pages and applications of the current user.

$f1->getFacebookFeeds();
This returns the last statuses/posts of the current user.


E) Credits - top


Once again, thank you so much for purchasing this theme. As I said at the beginning, I'd be glad to help you if you have any questions relating to this library. No guarantees, but I'll do my best to assist.

Kire (Yougapi Technology LLC)

Go To Table of Contents