× Joomla Facebook Connect support forum

Topic-icon Using JFBConnects $_FbRoot

Active Subscriptions:

None
14 years 3 months ago #2534 by funkydimensions
Hello,
I was wondering if its possible to somehow use the facebook api which is initiated by JFB in other parts of my code. I noticed in the facebookhelper.php it does...

self::$_FbRoot = new Facebook($facebookApiKey, $facebookSecretKey);

is there someway to use that $_fbRoot globally throughout my pages to make other API calls?

Thanks.
The topic has been locked.
Support Specialist
14 years 3 months ago #2595 by alzander
Replied by alzander on topic Using JFBConnects $_FbRoot
Yes. Actually, you should use FbClient like so:
require_once (JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'helpers'.DS.'facebookhelper.php');
$fbClient = JFBConnectFacebookHelper::getFbClient();

Then you can do things like getting the user's fb id and check if the user is logged into FB:
$fbId = $fbClient->user
if ($fbId)
// do something for logged in users

The client is a reference to the following file, so you should be able to call any functions from that file to get user's friends, photos, etc. If you come up with something neat, let us know!
/administrator/components/com_jfbconnect/assets/facebook-api/facebookapi_php5_restlib.php
The topic has been locked.