Giter Site home page Giter Site logo

fabriceb / sffacebookconnectplugin Goto Github PK

View Code? Open in Web Editor NEW
47.0 3.0 25.0 308 KB

A Facebook Connect plugin for symfony that lets you add easily Facebook connect to your symfony website and/or develop IFrame-FBML agnostic Facebook applications

Home Page: http://www.symfony-project.org/plugins/sfFacebookConnectPlugin

License: MIT License

JavaScript 33.87% PHP 66.13%

sffacebookconnectplugin's Introduction

sfFacebookConnectPlugin
=======================

The sfFacebookConnect plugin :

  * helps easily setup a Facebook Connect authentification on a symfony project using sfGuardUser

  * is also a good wrapper to create a Facebook application using symfony

Installation
------------


  * Install the plugin : the __git__ and recommanded way


        $ git submodule add http://github.com/fabriceb/sfFacebookConnectPlugin.git plugins/sfFacebookConnectPlugin
        $ cd plugins/sfFacebookConnectPlugin
        $ git submodule init # add the facebook php-sdk as a submodule
        $ git submodule update

        # or all in one
        $ git submodule add --recursive http://github.com/fabriceb/sfFacebookConnectPlugin.git plugins/sfFacebookConnectPlugin

  * Create your application on Facebook

        http://www.facebook.com/developers/


  * Configure your `app.yml` file with all the correct settings

        [yml]
        # default values
        all:
          facebook:
            api_key: xxx
            api_secret: xxx
            api_id: xxx
            redirect_after_connect: false
            redirect_after_connect_url: ''
            connect_signin_url: 'sfFacebookConnectAuth/signin'
            app_url: '/my-app'   # the facebook application canvas url
            guard_adapter: ~     # to customise a guard adapter
            js_framework: none # none, jQuery or prototype.
    
        # It is highly recommended to use a js framework if you want a correct experience in IE    
          sf_guard_plugin:
            profile_class: sfGuardUserProfile
            profile_field_name: user_id
            profile_facebook_uid_name: facebook_uid
            profile_email_name: email
            profile_email_hash_name: email_hash
    
          facebook_connect:
            load_routing:     true
            user_permissions: []         


  * Modify your `sfGaurdUserProfile` schema to add the 3 new columns needed

        [yml]
        # Doctrine schema sample
        sfGuardUserProfile:
          tableName:     sf_guard_user_profile
          columns:
            user_id:          integer(4)
            first_name:       varchar(20)
            last_name:        varchar(20)
            facebook_uid:     integer(5) # Must be BIGINT to fit Facebook's uids
            email:            varchar(255)
            email_hash:       varchar(255)
          relations:
            sfGuardUser:
              type: one
              foreignType: one
              class: sfGuardUser
              local: user_id
              foreign: id
              onDelete: cascade
              foreignAlias: Profile


  * Enable the auth module in your `settings.yml`: `sfFacebookConnectAuth`

        [php]
        all:
          .settings:
            enabled_modules:      [default, sfFacebookConnectAuth]

  * (Optional) Enable the sample module in your `settings.yml`: `sfFacebookConnectDemo`

        [php]
        all:
          .settings:
            enabled_modules:      [default, sfFacebookConnectAuth, sfFacebookConnectDemo]

  * Eventually use the sfFacebook filters
  
  * etc. A lot still needs to be documented.
          
  * Clear your cache

        $ php symfony cc

  * Publish the plugin assets

        $ php symfony plugin:publish-assets

sffacebookconnectplugin's People

Contributors

abv avatar garak avatar jostster avatar laurentb avatar patryk avatar tobiassjosten avatar

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

Watchers

 avatar  avatar  avatar

sffacebookconnectplugin's Issues

Cannot call abstract method sfFacebookGuardAdapter::getUserProfileProperty()

Strict Standards: Non-static method sfFacebookGuardAdapter::getUserProfileProperty() should not be called statically, assuming $this from incompatible context in /home2/ameriee2/aksymfony/plugins/sfFacebookConnectPlugin/li b/sfFacebookApplicationFilter.class.php on line 25

Fatal error: Cannot call abstract method sfFacebookGuardAdapter::getUserProfileProperty() in /home2/ameriee2/aksymfony/plugins/sfFacebookConnectPlugin/lib/sfFacebookApplicationFilter.class.php on line 25

Empty sfGuardUser

My newly created sfGuardUser doesn't have any information in it, other than the Facebook ID. Is perhaps because of a change on the FB side?

When I try the Graph API to poll information about my user, it's all there. As documented on http://developers.facebook.com/docs/reference/api/user:

$fb_uid = sfFacebook::getAnyFacebookUid();
$ret = sfFacebook::getFacebookApi($fb_uid);
var_dump($ret);

api_client Undefined

In the file sfFacebookConnect.class.php
for example line 30 :
$rows = sfFacebook::getFacebookClient()->api_client->fql_query($query);
But with the new sdk facebook, attribute api_client doesn't exist.
It's the same problem line 178,179,184,201

Spanish locale

To have the login in spanish you can change the array in sfFacebook::getLocale from:

    $culture_to_locale = array(
      'fr' => 'fr_FR',
      'en' => 'en_US',
      'de' => 'de_DE',
      'it' => 'it_IT',
    );

to:

    $culture_to_locale = array(
      'fr' => 'fr_FR',
      'en' => 'en_US',
      'de' => 'de_DE',
      'it' => 'it_IT',
      'es' => 'es_ES',
    );

Logout

Hi,

I'm using v1.1.1 since yesterday, and I can't logout a user connected with facebook.
I'm trying FB.logout(); and it doesn't work...
I still searching by my side, but if you can help me...
Thanks in advance.

Incorrect use of 'redirect_after_connect' config?

In the sfFacebookConnectAuth module, line 56 of lib/BasesfFacebookConnectAuthActions.class.php file, I found this:

$create_automatically = !sfConfig::get('app_facebook_redirect_after_connect', false);
$sfGuardUser = sfFacebook::getSfGuardUserByFacebookSession($create_automatically);

It seems to me that maybe we are not fetching the correct configuration? Do you remember what the intention was, Fabrice? Should we just replace it with another configuration key? Or am I perhaps misinterpreting the meaning of "redirect_after_connect"?

api_client Undefined in task

Notice: Undefined property: Facebook::$api_client in /home/www/labs/plugins/sfFacebookConnectPlugin/lib/sfFacebookConnect.class.php on line 185

it happens when i run registerUsersTask.class.php
it seems that the facebook session isn't created ...

Another little problem, i found a double declaration of getFacebookCookie in sfFacebook.class.php.

Problem creating an user / updating : Constraint violation

Hello,

After setting up the plugin correctly and click on the facebook button got a constraint error (log here : http://pastie.org/private/x8n5gvyooqnj9yx5smhvq) :

case number one :

  • I already have an account and i want to associate the facebook to simplify the login process :

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (myproject.sf_guard_user_profile, CONSTRAINT sf_guard_user_profile_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user (id) ON DELETE CASCADE ON UPDATE CASCADE)

You can see the YAML of the sfGuardUserProfile here : http://pastie.org/private/jbdxxcha4pd5wwrmccjpq

case number two :

I want to create an user using the plugin.

  1. I drop all the content of my table (sfGuardUser / Profile)
  2. I click on the connect button :

I've got the SAME error message, here are the logs from the debug bar : http://pastie.org/private/x8n5gvyooqnj9yx5smhvq

Is it happening only to me ? :O

Update for current sfDoctrineGuard compatibility.

The current stable releas of sfDoctrineGuard adds an email column email_address so the email no longer needs to be stored in the profile. There should be a setting to more directly control this without having to write your own adapter class.

Futhermore, If you arent already using a user profile its silly to make one for just three columns (2 if you exclude email now that sfguard supports it directly) when you can just override the sfGuardUser schema at the project level to add the columns in question. It would be nice if there were options to let the plugin know if you are using a profile at all or if it shoudl just look at the user class.

Call to undefined method Facebook::get_loggedin_user()

Trying to connect existing users with their Facebook account clicking on the button (user just logged in via site login system) I get this error. Method get_loggedin_user() was in the old sdk, is it possible to fix it in a simple way? Thanks

Different cookie name in sfFacebookConnectPlugin and php-sdk

I don't know is it bug or feature. But when you log in with facebook button it sets cookie name like fbs_ApiKey.

But in vendor/php-sdk/src/facebook.php cookie name is like this:

protected function getSessionCookieName() {
    return 'fbs_' . $this->getAppId();
}

And so, when you want to get access token, you are using getSession(). And if you use cookies, you wouldn't get correct access token(because you are using wrong cookie name).

Issue on getFacebookCookie()

Hello and thanks for the plugin!
sfFacebook.class, line 20, should be changed from: $app_id = self::getApiKey(); to $app_id = self::getApiId();

User Permissions

Hi everyone,
I am trying to configure permissions for an application using "user_permissions" in the app.yml but I can not make the form of Facebook ask these permits.
How I can do that?

Demo still calls $sf_user->getCurrentFacebookUid() even though sfFacebookUser has been eliminated

Hi,

I've discovered a small but potentially confusing remnant from when myUser extended sfFacebookUser.

In modules/sfFacebookConnectDemo/templates/indexSuccess.php, there still remain two lines where $sf_user->getCurrentFacebookUid() is called. However, since myUser no longer inherits from sfFacebookUser, these lines result in a PHP error and halts execution.

If you remove those two lines, the demo works great.

Thanks!
-Ben Arwin

sfFacebookUser class removed

It seems that when you were cleaning up the code you removed the sfFacebookUser class which myUser is supposed to extend too. The documentation says to still extend to sfFacebookUser in myUser but an error is thrown that the class cannot be found.

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.