Welcome Guest, Not a member yet? Register   Sign In
Facebook Connect - class init problem

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"

I'm not sure this answers your question, but Facebook just released an updated PHP SDK the other day. http://developers.facebook.com/blog/post/503

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).

[eluser]Nisha S.[/eluser]
I have wrote a library and you can get it from http://www.betterhelpworld.com/codeignit...odeigniter which is based on new SDK.

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 :-(

Theme © iAndrew 2016 - Forum software by © MyBB