Drupal for Facebook - The Next Release

Modules/fb has a long (sometimes arduous) history. Integrating Drupal
with Facebook's platform basically since the platform became
available. Back then, all Facebook apps were what we now call "canvas
pages"; Facebook Connect did not exist. Canvas pages were written in
FBML, whereas now they are iframes. Facebook has completely changed
their PHP and Javascript SDKs, and introduced the "Open Graph". In
short, these modules have changed a lot over the last couple years.
Almost every feature has been reimplemented once or twice.

As with most software projects as they get older, it's tempting to do
a complete rewrite. Doing so would clean out the obsolete bits of
code that are no longer used, or no longer best practice (or no longer
working at all). Here are some thoughts about what this
rewrite-from-scratch might look like.

  • No Dependency on PHP SDK -- Fortunately Facebook's platform has
    evolved to be based entirely on internet standards. Most
    interaction is based on JSON over HTTP. Drupal already has helper
    functions for these protocols, which modules/fb can use instead of
    what facebook provides. Frankly I expect Drupal's code to be more
    reliable, better implemented and supported. Plus the modules would
    be self-contained, not requiring an extra download as part of the
    install process.
  • Less Canvas Page Code -- Initially, app were all canvas page, and
    canvas pages were difficult to support. These days, they are
    iframes, which makes them basically a regular web page. They are
    not restricted to just 760px. Drupal already does a good job
    serving them up. It might be possible to eliminate fb_canvas.module
  • Less Application Configuration -- Once upon a time, modules/fb could
    create an app for you. You never had to visit facebook.com, cut and
    paste IDs and SECRETs etc. That's no longer possible, and facebook
    has a bunch of properties associated with apps that Drupal cannot
    modify. In short, you basically have to visit facebook.com to
    configure your app. And the tools provided by facebook are much
    better than they used to be. So, modules/fb should work well with
    apps that are not configured via Drupal. There are some features,
    like posting to facebook, which do not even require that an
    application is hosted on Drupal.
  • Token Management -- These days, interaction to the facebook platform
    is all about tokens. There's a token for each user (or page) that
    uses an app. These tokens make features possible, even if Drupal is
    not configured with an application secret. So, as features become
    more dependent on tokens, modules/fb has to provide a clean and easy
    way to manage lots of tokens.

These are changes I have in mind for a next release (modules/fb 4.x).
The goal being a cleaner, smaller set of code. Not supporting all the
same features, its worth noting. I think its best to do away with the
parts that may no longer be needed, don't work optimally and and hard
to support. Even if doing so will lead to some headaches for users
upgrading from the current version. That is, after all, the Drupal

Mohamed Al Arabi's picture

Have got the weirdest problem on D7 DFF, comment forms redirect to blank pages!

Mohamed Al Arabi's picture

is that significant?

Mohamed Al Arabi's picture

using a debugger while posting this comment. Disregard.