ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

codeigniter facebook library

September 03, 2013 2:22am

Subscribe [1]
  • #1 / Sep 03, 2013 2:22am

    weblounge

    1 posts

    codeigniter facebook library

    1. Copy and paste facebook directory from library folder.
    2. Copy and paste facebook.php page from config folder.
    3. Set AppId and Secret in facebook.php page from config folder.
    4. Create controller called as “facebook_login.php”.

    5. Load library :

    //CONSTRUCTOR
          public function __construct(){
    parent::__construct();
    $this->load->library('facebook/fb','fb');
    }
    6.Create Links And Get Profile Data:

      // INDEX
            public function index(){
    $data['login_url'] = $this->fb->createLoginLink();
    $data['user_profile'] = $this->fb->initialize();
    }
    7.Create view called as facebook_login.php

    8.Copy and paste below code.

            // CREATE LINK
            <?=IMAGES?>log_with_fb.png
            [removed]         
              function popup(url) {
    newwindow=window.open(url,'name','height=200,width=150');
    if (window.focus) {newwindow.focus()}
              return false;
              }

              window.onload = function(){
    window.opener.location.reload(true);
    window.close();
    }();
            [removed]

            // GET PROFILE DATA
            $user = $this->facebook->getUser();
            if($user <> “”)
                    {
    echo "

    ";
                                print_r($user_profile);
                                echo "

    “;
                    }

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases