Integration of Facebook Connect into SilverStripe

Installs: 709

Dependents: 0

Stars: 43

Watchers: 10

Forks: 18

Open Issues: 4

Type: silverstripe-module

1.3.0 2014-07-11 03:36 UTC


Maintainer Contact

  • Will Rossiter


  • SilverStripe 3.1


The module provides a basic interface for implementing the Facebook PHP SDK on your SilverStripe website. The Facebook SDK allows users to login to your website using their Facebook account details, creating a single sign-on within the existing SilverStripe member system.

What it provides

  • Loads the Facebook PHP SDK.

  • Provides $FacebookLoginLink template variable to generate a link to login to Facebook. Upon clicking the link and being redirected back to your application the SilverStripe Member::currentUser() will be populated with a Member instance linked to the users Facebook profile.

<% with CurrentMember %>
    $Name $Avatar(small)
<% end_with %>


composer require "wilr/silverstripe-facebookconnect" "dev-master"

Register your website / application with Facebook.

Set your configuration through the SilverStripe Config API. For example I keep my configuration in mysite/_config/facebookconnect.yml file:

  app_id: 'MyAppID'
  api_secret: 'Secret'

Update the database by running /dev/build to add the additional fields to the Member table and make sure you ?flush=1 when you reload your website.

<a href="$FacebookLoginLink">Login via Facebook</a>

You can also access the Facebook PHP SDK in your PHP code..

// https://developers.facebook.com/docs/php/FacebookSession/4.0.0
$session = Controller::curr()->getFacebookSession();

For more information about what you can do through the SDK see:



All the following values are set either via the Config API like follows

Config::inst()->update('FacebookControllerExtension', '$option', '$value')

Or (more recommended) through the YAML API

FacebookControllerExtension: option: value


Your app id. Found on the Facebook Developer Page.


Facebook API secret. Again, from your Application page.


Optional, default: true

Whether or not to create a Member record in the database with the users information. If you disable this, ensure your code uses $CurrentFacebookMember rather than $Member. Other access functionality (such as admin access) will not work.


Optional, default ''

A list of group codes to add the user. For instance if you want every member who joins through facebook to be added to a group Facebook Members set the following:

FacebookControllerExtension: member_groups: - facebook_members


Optional, default 'email'

A list of permission codes you want from the user. Permission codes are listed on developers.facebook.com.

Ensure you include email in your list if you require create_member.


Default 'email','first_name','last_name'

A list of fields you want to retrieve from Facebook for the user. Available fields are listed on developers.facebook.com.

Ensure you include email in your list if you require create_member.


Optional, default true

Flag as to whether to replace user information (such as name) in your database with the values from Facebook.


Released under the BSD-3-Clause License.