CodeIgniter Forums
Facebook Connect - class init problem - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Facebook Connect - class init problem (/thread-41295.html)

Facebook Connect - class init problem - El Forum - 05-04-2011

I'll go ahead and feel silly in front of everyone, cuz I can't spot what the issue here is, though I suspect it will be a real groaner. maybe describing it will jog something in my mind.

i am doing a Facebook Connect integration with CI2.0, based on this guy's work:

which I've upgraded to 2.0

some relevant code bits are:

$config['facebook_api_key'] = 'xxx';  (it is the ID, not the key, as he misnamed his array key)
$config['facebook_secret_key'] = 'xxx';

function index() {


    class fb_connect {

        function fb_connect()
            //Using the CodeIgniter object, rather than creating a copy of it
            $this->_obj =& get_instance();
            //loading the config paramters for facebook (where we stored our Facebook API and SECRET keys
            //make sure the session library is initiated. may have already done this in another method.
            $this->_api_key        = $this->_obj->config->item('facebook_api_key');
            $this->_secret_key    = $this->_obj->config->item('facebook_secret_key');

            $this->appkey = $this->_api_key;

            //connect to facebook
            $this->fb = new Facebook(array(
                          'appId'  => $this->_api_key,
                          'secret' => $this->_secret_key,
                          'cookie' => true

and finally, the facebook php library:
public function __construct($fb_config) {
    if (isset($fb_config['cookie'])) {

The best way I can describe the issue is just to give you the output of print_r($fb_config):

Array ( [facebook_api_key] => xxx [facebook_secret_key] => xxx)

Message: Undefined index: appId
Message: Undefined index: secret

The facebook __construct() has been loading with the config file's $config[] array; no idea why it is doing this.

Thanks in advance for any leads or spottings of "dumb things I've done"

Facebook Connect - class init problem - El Forum - 05-25-2011

I'm not sure this answers your question, but Facebook just released an updated PHP SDK the other day.

You can put these two PHP files in your libraries folder and use them directly as in the examples in that blog by using
(Use $this->facebook instead of $facebook as in the examples in the blog post.)

I have not dealt with facebook connect, but I was under the impression that is the old legacy facebook integration process and that the graph API is the new way (and much easier in my opinion).

Facebook Connect - class init problem - El Forum - 07-13-2011

[eluser]Nisha S.[/eluser]
I have wrote a library and you can get it from which is based on new SDK.

Facebook Connect - class init problem - El Forum - 07-13-2011

sorry - never came back to answer this. it was "a real groaner" as i suspected - a class conflict with a previously installed facebook_connect library I didn't know about :-(