Git Product home page Git Product logo

cakephp-facebook-plugin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cakephp-facebook-plugin's Issues

Class 'Facebook' not found

Hi,

i'm trying to use the plugin but i can't bring it on work. I get following:

Fatal error: Class 'Facebook' not found in /Users/emrahgul/Sites/evento/app/Plugin/Facebook/libs/f_b.php on line 21

public function __construct() {
if (empty(self::$Facebook)) {
self::$Facebook = new Facebook(FacebookInfo::getConfig());
}
}

CAKEPHP FACEBOOK PLUGIN version 3.1.1

unidefined property:Facebook

I have trying the fix this error.i seem not to know its source. Notice (8): Undefined property: View::$Facebook [APP\views\pages\display.ctp, line 3].

please help

Custom Login Image Path

Thank you again for this awesome plugin.

The image path in the FacebookHelper for the custom login button gets changed to:

$source = '/Facebook/img/'.$options['img'];

It would be nice to have the flexibility of passing through the path you would like to use.

Facebooks users information only show after second acess

I'm using cakephp 2.0

step to procedure :

        $this->Connect->authUser['User']['name'] = $this->Connect->user('name');
        return true; //Must return true or will not save.

`````` }

Erase cookies and the user in the table ...
Try to acess your application , the name in table will be null.
Refresh  the page and the name will be update.

I fix it puting this lines in Initialize (and remove startup method)
```if (!$this->noAuth && !empty($this->uid)) {
    $this->__syncFacebookUser();
```}

Infinite reload

Hey Nick, thanks for your plugin.
In the lasts months, something goes wrong, I have this problem:
If I am logged in facebook and I go on the website that I'm working on, there is an reload every second.

I've seen that you have the same problem in the application example.
http://facebook.webtechnick.com/
I'm triyng to figure out whats happen, It's seems that at the connect.php line 61 the getSession() method fail.

Have you some suggestion about?

function html() on a non-object

i download the file in https://github.com/webtechnick/CakePHP-Facebook-Plugin/tree/cakephp2.0
and followed the instructions but i seem to get an error when i add "Facebook.Connect" in AppController.php
here is the AppController code

class AppController extends Controller {

var $uses = array('Messages.Message', 'Settings', 'User');
var $components = array('Auth', 'Session', 'Facebook.Connect' );
var $helpers = array('Html', 'Form', 'Js', 'Session', 'Facebook.Facebook');

and the code for default.ctp is

Facebook->html(); ?> <title></title> <
Facebook->share(); ?>
<div id="header">
element('sql_dump'); ?> Facebook->init(); ?>

Fatal error: Call to a member function html() on a non-object in app/View/Layouts/default.ctp on line 2

CakePHP 2.0 Redirect after login does not work

Method I

        $this->redirect(array('controller' => 'pages', 'action' => 'home'));
   }

My afterFacebookLogin() function it only works after I reload the page from where I logged in or go to another page.

Method II

I also tried to enable 'redirect' => true in FacebookHelper.php. The problem is that when it is set to true it dissapears.

What can I do in this case?

First page load fails to login on Canvas App

First of all, thanks for the great plugin! It helped me a LOT!

Now for the issue:

When making a canvas app, you don't really need to check if the user is logged in to Facebook, since the user isn't supposed to get to the page if he isnt. The canvas app works from inside facebook itself, so that's why.

Problem is when I open the first page on the canvas app, both Auth and Connect->user() are empty, meaning there's no user logged in (which isn't true, of course). When I refresh the frame or click on any page inside it, then it's all normal, both Auth and Connect->user() show the correct info.

Unable to log out issue

So I've got the system working half-well. When I log into facebook, it logs me into my cakePHP app.

In my users/logout function, I redirect back to the homepage.

I've routed the facebook logout to my logout function in my users controller. When I use that, the logout logs me out of facebook but not on my cakePHP app.

When I log out by going just to the logout function while still logged into facebook (and not logging out of facebook), nothing happens.

I removed the redirect from the logout function and when I sign out, it appears to work, but when I navigate back to the home page (or any other page), it logs me back into my cakePHP app.

My solution for this was to manually delete the entire session before I redirect

function logout()
{
$this->Auth->logout();
$this->Session->destroy();
$this->redirect(array('controller' => 'articles', 'action' => 'index'));
}

While this appears to be working, I'd like to know why it's necessary? What am I doing wrong here??

1.3 Current FB SDK needs to be upgraded.

The current version (included in your plugin) incorrectly handles FB session cookies which are used for login. The latest version of the FB PHP SDK appears to work fine.

Facebook comment area not rendering

i have tested echo $this->Facebook->share(); to know if the plugin was working,this worked without errors.i tried using echo $facebook->comments(); but the comment area is not showing.

I have included echo $this->Facebook->html() and $this->Facebook->init(); in the default layout. Its not displaying any error,neither is displaying the facebook comment.

I then changed the facebook plugin parameters to a wrong one. The echo $this->Facebook->share() still worked.what could be wrong.

array( 'appId' => '', 'apiKey' => '', 'secret' => '', 'cookie' => true, 'locale' => 'en_US', ) ); ?>

what could be wrong

login logout issue

Hi,

I just realized your website doesn't work properly. I'm not able to login to see "myaccount", i always see the login button. The first time i got the permissions request, but after that i still can't see "myaccount".

I have a similar problem in my application. I followed your screencast and the svn app. I can log in, i. e., when i login via facebook, i can see "myaccount". The problem is, when i click logout, i only exit the facebook session, but i can still see myaccount... any help?

Maybe the my app's advanced configs have somthing to do...

Running Mac OS X Lion
with Chrome 13.0.782.99 beta
from Facebook iFrame Canvas @ php sdk 3.1.1

FB Helper init function

In the FB.init() there is the status flag, you could put it in the configuration, because this causes some errors when you are logged in as a normal user (nof from facebook connect) and do not want to connect your accont with the facebook account.

Login fails on primary key

I have the facebook_id as a primary key for my auth table. I want to duplicate the facebook graph for the users I get, but when it goes to login, if the facebook_id already exists it doesn't update the password field, and instead fails to update the view UI instead.

Not sure if this is in the Auth component of CakePHP or in the Facebook code. Happy to help fix it however I can.

Login button invisible after initial login (cake 2.0 branch)

I got the following problem, I try to get Facebook Connect working. The problem:

1.) $this->Facebook->login(); creates a Login button which shows up. After I click it Facebook asks me for permission which works fine. I accept it and I am logged in.

2.) I logout of my page with $this->Facebook->logout(); I get logged out of Facebook AND my application. So far so good. But when I go to my start page on my website, the Facebook login button does not appear anymore.

It seems the JS tries to poll some information from FB since there is this loading animation but it then disappears into nothing. When I log in via facebook itself I am logged in again in my application. Maybe its a problem with the facebook API itself? But I could not find any clue :( One other detail: when I go to facebook privacy settings and delete the connection to my application/website, the login button appears again...

Testwebsite: http://shoodi.tfelix.de (website for recording shooting results, sorry its in german for now, but I think to recreate the funny behaviour its enough...)

Logout not working

I use this, but dont work:

Facebook->logout( array('redirect' => array('controller' => 'users', 'action' => 'logout', 'panel' => true) )); ?>

Using cakephp 1.3
Login function working perfectly.

Thanks.

Cakephp 2.0 - afterFacebookLogin doens't works

Hello,
I write my afterFacebookLogin() function in the Users controller where I put in the login action the fb login.

After login the function doesn't work!

Kind regards,
Alex Genovese

Canvas page constantly refreshes

I'm getting reports that some people are constantly getting page reloads when they visit my app. Looking through forums and everything I'm thinking it may have something to do with the user not being able to get authenticated correctly thus causing this line to be run:

FB.Event.subscribe('auth.login',function(){window.location.reload()});

I was also just now able to reproduce this refreshing on Safari and IE7

Cannot connect with database

I am using CakePHP 2.0.5 / OS X 10.6 / MAMP PRO

I can't get it working with the cakephp auth. I followed the video tutorial and I've read the installation tutorial but it does not change anything in the database. When I login with facebook it doesn't execute any query at all. Also it does not show the logout button.

You can see what it displays after login here: http://i43.tinypic.com/144cw94.jpg

What could cause this problems?
If there is anything more that you need to help me please ask.

Thank you in advance.

Here you have come code:

AppController.php

class AppController extends Controller {
    public $helpers = array('Facebook.Facebook', 'Html', 'Session', 'Form');

    public $components = array(
        'Session',
        'Auth' => array(
            'loginRedirect' => array('admin' => 'false', 'controller' => 'users', 'action' => 'index'),
            'logoutRedirect' => array('controller' => 'users', 'action' => 'index'),
            'authorize' => array('Controller'),
        ),
        'Facebook.Connect'
    );

    function beforeFilter() {
        $this->Auth->allow('display'); //obligatorie
        $this->set('facebook_user', $this->Connect->user());
        $this->set('logged_in', $this->_loggedIn());
        $this->set('currentUser', $this->Auth->user());
        if (isset($this->params['admin']) && $this->params['admin'] == 'admin') {
                    $this->layout = 'admin';
        }
    }

    function beforeFacebookSave(){
        $this->Connect->authUser['User']['email'] = $this->Connect->user('email');
        return true; //Must return true or will not save.
    }

    public function isAuthorized() {
        return true;
    }

    public function _loggedIn(){
            $logged_in=FALSE;
            if ($this->Auth->user()){
                $logged_in=TRUE;
            }
            return $logged_in;
            //!empty($this->Auth->user());
    }
}

In the view i've put the following code:

`````` $this->Facebook->login()```

I have also replaced <html> with the next line:
echo $this->Facebook->html();

and i've put this line just before </body>
echo $this->Facebook->init();

In the database inside table users i've added a column named facebook_id

Make extending "User" object easier

It would be nice if it were easier to extend the "User" object so that more than the Facebook ID can be saved as part of the Auth registration flow

Login Button does not appear at firefox

Dear Nick, I have play around with the branch 2.0 with the Facebook->login();?> but the Login Button seem like does not work. So, I remove the FacebookHelper.php Line 458: $init .= '<script src="//connect.facebook.net/en_US/all.js"></script>'; and the button appear. That's my report. Thanks

Login/Logout buttons

Hi, i added the follow code to my home.ctp page but the login/out button don't work properly.

Facebook->logout(); ?> Facebook->login(); ?>

it seems like the redirect don't work at all, what im doing wrong?

FB login screen doesn't disappear after login

Hi Nick,

Thank you for this awesome plugin. I have it working except for the login functionality.

I am using 2.0 and Auth with Security.

For some reason when I use the FB login and fill out my FB info in the FB window and hit submit the window does not disappear and I have to hit my login button on my app two times to get the system to recognize me.

This is after I close the initial FB screen which has turned white and still appears over my browser.

I thought I could add a redirect in the actual FB login Facebook->login(array('perms' => 'email, user_birthday')); ?> but when i try to do that it breaks the code and doesn't show up.

Facebook->login(array('perms' => 'email, user_birthday', 'show_faces' => false, 'width' => 400, 'redirect' => '/users/login/')); ?>

gives me

Thanks again. Any help is appreciated.

Brad

Changing button style

I would to use a different FB Connect button than the default one, how can I change the style of it?

It seems that "perms" is not valid anymore

Hi! Four days ago everything was working well on my site (localhost), I'm using CakePHP-Facebook-Plugin in order to authenticate users into my site through facebook, but then not anymore. I blamed on some changed I did and I rolled back to the "latest-working" versions from the SVN and it seems I still get the same problem.

I tracked down a JS exception and it seems the problem is the "perms" parameter on login() function. Then I changed "perms" to "scope" and the facebook popup is working again but with some other problems, anyway this is the code

$facebook->login(array('perms' => 'email')); // not working
$facebook->login(array('scope' => 'email')); // working

am I the only one that is getting this problem?
Thanks

This is the JS error:
OAuth2 specification states that 'perms' should now be called 'scope'. Please update.
[Break On This Error] FB.provide('',{getLoginStatus:function...signed_request,code'});return a;}}});

Custom Login Permissions

Firstly this is a great plugin that saved me loads of time, thank you!

The login control is ignoring permissions when custom is set to true because the 'scope' option is hard coded to 'email' in the javascript login function.

I fixed this by passing through the perms string to the login function, for reference here are my changes to the FacebookHelper class:
113 - $perms = isset($options['perms']) ? $options['perms'] : 'email';
$onclick = "login('".$options['redirect']."', '".$perms."');";

497 - function login(redirection, perms){

510 - }, {scope: perms});

Call to undefined method SessionComponent::start() connect.php on line 64

i created app which has user authentication all ready, i want to implement facebook plugin but after entering

var $components = array('Auth', 'Session','Facebook.Connect');
var $helpers = array('Html', 'Form', 'Js', 'Session', 'Facebook.Facebook');

i get an error

Fatal error: Call to undefined method SessionComponent::start() in /Users/emrahgul/Sites/evento2/app/Plugin/Facebook/controllers/components/connect.php on line 64

can some one help

Share and comments can't be used together

Hi,

I'm writing a facebook application using this wonderful plugin, thanks!
I'm wondering though, why both comments and share function work when used separately, but stop working when used together?
If i try to use them both i only get the share button (no comments). why is that? minor bug or am i confused in smth?

thanks!

Lucas

Class 'Facebook' not found

Hi,

i'm trying to use the plugin but i can't bring it on work. I get following:

Fatal error: Class 'Facebook' not found in /Users/eneskul/Desktop/vhosts/game/htdocs/app/Plugin/Facebook/libs/f_b.php on line 22

My AppController:

public $components = array('Session',
    'Auth' => array(
        'authenticate' => array(
            'Form' => array(
                'fields' => array('username' => 'email')
            )
        ),
        'authorize' => 'Controller'
    ),
    'Facebook.Connect' => array('model' => 'User')
);


function beforeFilter()
{
    //Configure AuthComponent

    $this->Auth->allow('*');
    $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
    $this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
    $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'index');
}

CakePHP version 2.0.3

Fatal error!!!

my problem is,if i run my apps on web project.facebookviet.vn,no problem
but when i run my apps on host sieu.vn,have one error:

Fatal error: Uncaught GraphMethodException: Unsupported get request. thrown in mydomain\wwwroot\apps\base_facebook.php on line 1033
and in fbmain.php have one a error:
Fatal error: Class 'Facebook' not found in D:\Domains\sieu.vn\wwwroot\apps\fbmain.php on line 26
i don't know,please help me
thank all!

Facebook::__construct() call session_start() before CakeSession

Seem that Facebook SDK class breaks cakephp session behavior starting session outside of session component, because of CakePHP1.3 (2.0+ too?) starts session in SessionComponent::startup() after Components::initialize and Controller::beforeFilter() in Controller::startupProcess.

So, database and cake sessions dont work.

I temporary solved with a workaround patching ConnectComponent::initialize() to force Session start before of Facebook::__construct().

    function initialize(&$Controller, $settings = array()){
        $this->Controller = $Controller;
        if (!$this->Controller->Session->started()) {
            $this->Controller->Session->start();
        }
        $this->_set($settings);
        $this->FB = new FB();
        $this->uid = $this->FB->getUser();
    }

FB Login button doesn't appear on Firefox

Just followed the tutorial exactly as you had it in the screencast.

Facebook->login(); ?> gets converted to fb:login-button but does not get turned into an actual login button in Firefox 6.0.2 at least. Doubt its a problem with your code, seems more like something to do with Firefox, but just thought I'd let you know and see if you have any ideas.

Class 'FB' not found

hi,

i am using 2.1.1 facebook plugin in cakephp but it is not working.
every time show "Fatal error: Class 'FB' not found in /app/controllers/components/connect.php on line 61 "
this error.

please help

roseroja

Fatal error: Facebook not found in /Plugin/Facebook/libs/f_b.php

Hello,
I have installed in /app/plugin/ the Facebook Plugin in Cakephp 2.0.5 but it doesn't work fine.

Steps:

  1. copied the plugin in in app/plugin/
  2. facebook.php copied in app/config/ configuration files with all configuration codes.
  3. replaced the layout with that in the example

the error is:

Fatal error: Class 'Facebook' not found in /Applications/MAMP/htdocs/emailmarketing/app/Plugin/Facebook/libs/f_b.php on line 21

Thanks in advance
Alex Genovese

I cant'n use the plugin

Hi, i have cake 2.0.2 and i trying to use the plugin, i follow all the instruccions but always say : "Fatal error: Call to a member function info() on a non-object in C:\servidor\astroagenda\app\View\Pages\home.ctp on line 3 "

Nothing displayed

Hi Nick,

After following the instructions from the Readme file I wanted to display a comment box. However; nothing is displayed, no comment box and no errors.

I have uploaded all files to the facebook directory within plugins, changed the settings in the config file, loaded the helper (the tag is correctly changed, as well as the javascript that's added to the bottom of my page), but nothing happens.

Any ideas? Thanks in advance!

Database table error with cake 2.0

Hi there,
I get the following when trying to initialize the plugin. The actual button for login works, but the page is filled with an error when the plugin is active:
Missing Database Table
Error: Database table app_models for model AppModel was not found.
Notice: If you want to customize this error message, create app/View/Errors/missing_table.ctp
Stack Trace
#0 /Users/jwilcox/Projects/web-applications/akzo-color/lib/Cake/Model/Model.php(3236): Model->setSource('app_models')
#1 /Users/jwilcox/Projects/web-applications/akzo-color/lib/Cake/Model/Model.php(1206): Model->getDataSource()
#2 /Users/jwilcox/Projects/web-applications/akzo-color/lib/Cake/Model/Model.php(1292): Model->schema()
#3 /Users/jwilcox/Projects/web-applications/akzo-color/app/Plugin/Facebook/Controller/Component/ConnectComponent.php(108): Model->hasField('facebook_id')
#4 /Users/jwilcox/Projects/web-applications/akzo-color/app/Plugin/Facebook/Controller/Component/ConnectComponent.php(80): ConnectComponent->__syncFacebookUser()
#5 [internal function]: ConnectComponent->startup(Object(PagesController))
#6 /Users/jwilcox/Projects/web-applications/akzo-color/lib/Cake/Utility/ObjectCollection.php(110): call_user_func_array(Array, Array)
#7 /Users/jwilcox/Projects/web-applications/akzo-color/lib/Cake/Controller/Controller.php(606): ObjectCollection->trigger('startup', Array)
#8 /Users/jwilcox/Projects/web-applications/akzo-color/lib/Cake/Routing/Dispatcher.php(104): Controller->startupProcess()
#9 /Users/jwilcox/Projects/web-applications/akzo-color/lib/Cake/Routing/Dispatcher.php(89): Dispatcher->_invoke(Object(PagesController), Object(CakeRequest), Object(CakeResponse))
#10 /Users/jwilcox/Projects/web-applications/akzo-color/app/webroot/index.php(96): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#11 {main}

I wasnt sure if I had to create a new table for some reason, but I couldn't figure out the problem. I am using Cake 2.0 and trying to hook into the Auth I already have. Thanks for any support!

CakePHP 2.0 and the Facebook Plugin

I can't seem to get this to work with cakephp 2.0. Is there something in the plugin that needs to change, or is there any timeline for when it might work? I followed your steps to a T and it was working fine in 1.3, but I have a new site that is written with 2.0 that needs this. Thanks!

FB oAuth 2.0 update breaks plugin

With today's Facebook update all apps that are using this plugins Facebook Login is broken, including the demo on facebook.webtechnick.com.

This needs to be fixed as it cripples many sites.

FB::api('/me') doesn't work ?

Hi i'm getting php warning when trying to access to the facebook api :

Warning (2): call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object [APP/Plugin/facebook/Lib/FB.php, line 58]

and the FB::api('/me') call doesn't show any result ?
Any help well be great !!!! Thanks

Error

So I've extracted the folder in the zip, I am getting:

Undefined variable: facebook [APP/views/layouts/default.ctp, line 1]
Fatal error: Call to a member function html() on a non-object in /var/projects/dormillo/app/views/layouts/default.ctp on line 1 

Not quite sure what I'm doing wrong? I've followed the instructions in the readme including the config file...

In my AppController,

public $components = array('Session', 'RequestHandler', 'Auth', 'Facebook', 'Facebook.Connect', 'Facebook.FacebookApi');

And yep, it's cake 1.3

security concern

are you sure setting a default password value is a good idea ? https://github.com/webtechnick/CakePHP-Facebook-Plugin/blob/master/controllers/components/connect.php#L108

Let study the following case :

  • i log-in with facebook. my account password has now the "disabled" value (actually it is not disabled, just having this value)
  • sometimes on the web site, i can change/add my email address
  • this website has kept the CakePHP Auth login system enabled (because not everyone wants to log with facebook)
  • someone (for instance a facebook "friend") knows my email address and that i logged on the website
  • he just have to go to the website and enters my email address as the login and "disabled" as the password
  • he got my identity on the website

I haven't tested it now, i'll keep you in touch when this is done.

OAuth2 Incompatibility Issue

I keep getting the following error. Any ideas?

Error: FB.Auth.setSession incompatible with OAuth2.

Facebook config:

array( 'appId' => '244224708951284', 'apiKey' => '9747b40bc8bf0d6fd5ce3c7f71848136', 'secret' => 'fcf31bb815c9a6ee21101ff2e2dadfb1', 'cookie' => true, 'locale' => 'en_US' //'xfbml' => true, //'oauth' => true ) ); ?>

Facebook app settings:
Remove Deprecated Auth Methods - Enabled
Stream post URL security - Disabled
signed_request for Canvas - Enabled
Timezone-less events - Enabled
Upgrade to Requests 2.0 - Disabled
iframe Page Tab - Enabled
Require manage_notifications - Enabled
OAuth Migration - Disabled
Develop Using Deprecated FBML Canvas - Disabled

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.