Facebook Connect fatal error

Please I need someone to assist me in this plugin code,

It was given me the following error Fatal error: Cannot redeclare class Facebook in /home/vazebook/public_html/mod/facebook_connect/vendors/facebook/facebook.php on line 93

  • This is the code in facebook.php written below and the last line below is the line 93 it is pointing to

    <?php
    /**
     * Copyright 2011 Facebook, Inc.
     *
     * Licensed under the Apache License, Version 2.0 (the "License"); you may
     * not use this file except in compliance with the License. You may obtain
     * a copy of the License at
     *
     *     http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
     * License for the specific language governing permissions and limitations
     * under the License.
     */

    require_once "base_facebook.php";

    /**
     * Extends the BaseFacebook class with the intent of using
     * PHP sessions to store user ids and access tokens.
     */
    class Facebook extends BaseFacebook
    {
      /**
       * Identical to the parent constructor, except that
       * we start a PHP session to store the user ID and
       * access token if during the course of execution
       * we discover them.
       *
       * @param Array $config the application configuration.
       * @see BaseFacebook::__construct in facebook.php
       */
      public function __construct($config) {
        if (!session_id()) {
          session_start();
        }
        parent::__construct($config);
      }

      protected static $kSupportedKeys =
        array('state', 'code', 'access_token', 'user_id');

      /**
       * Provides the implementations of the inherited abstract
       * methods.  The implementation uses PHP sessions to maintain
       * a store for authorization codes, user ids, CSRF states, and
       * access tokens.
       */
      protected function setPersistentData($key, $value) {
        if (!in_array($key, self::$kSupportedKeys)) {
          self::errorLog('Unsupported key passed to setPersistentData.');
          return;
        }

        $session_var_name = $this->constructSessionVariableName($key);
        $_SESSION[$session_var_name] = $value;
      }

      protected function getPersistentData($key, $default = false) {
        if (!in_array($key, self::$kSupportedKeys)) {
          self::errorLog('Unsupported key passed to getPersistentData.');
          return $default;
        }

        $session_var_name = $this->constructSessionVariableName($key);
        return isset($_SESSION[$session_var_name]) ?
          $_SESSION[$session_var_name] : $default;
      }

      protected function clearPersistentData($key) {
        if (!in_array($key, self::$kSupportedKeys)) {
          self::errorLog('Unsupported key passed to clearPersistentData.');
          return;
        }

        $session_var_name = $this->constructSessionVariableName($key);
        unset($_SESSION[$session_var_name]);
      }

      protected function clearAllPersistentData() {
        foreach (self::$kSupportedKeys as $key) {
          $this->clearPersistentData($key);
        }
      }

      protected function constructSessionVariableName($key) {
        return implode('_', array('fb',
                                  $this->getAppId(),
                                  $key));
      }
    }

  • use the login i have put a link to above, also you can add this to the footer with footer edit plugin, shows more stuff when people login to facebook 

    or add to header with header plugin,or any where as long as it is the whole site the code is used on.

    http://community.elgg.org/plugins/1440827/1.13/social-login

     


    //
    (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=APPID;
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    // ]]>

    i tried the plugin your using does not work for me use the plugin i have posted

  • Ok I will give it a try now and give you the feedback

  • it gave this following error,

    Fatal error: Call to undefined method Facebook::destroySession() in/home/vazebook/public_html/mod/elgg_social_login/vendors/hybridauth/Hybrid/Providers/Facebook.php on line 106

  • ok enjoy! ^_^ it works so i know what your going to say lol ; ) 

  • this is what is on line 106

    $this->api->destroySession();

     

  • what do you think it should be on that line 106?

  • oh wow you got a error on this? make sure you delete any other social login eg: facebook connect then try again also make sure your details in settings are corect app id etc