Mapping Facebook accounts to local accounts
| Project: | Drupal for Facebook |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Dave Cohen |
| Status: | closed |
Currently, a limitation of Drupal for Facebook is that, while it will create a local (Drupal) account when Facebook users add an app, it does not help link the account of an app user to a local account that already exists. I'm working to improve the situation, and this issue will track progress.
The patch attached here needs work, but it shows the direction things are headed. (The patch includes a few changes not relevant to user mappings, I apologize for that, but I included all my recent changes to make sure I did not leave anything out.) The most important part of the patch is in fb_user_user(). There, when a user logs in or registers, the module creates the authmap entry necessary to link the accounts.
I'm also working to provide a link from the drupal URL to quickly add the app and associate the accounts, but this is a work in progress and not quite working yet.
There are some unrelated changes to stylesheets which work around IE bugs on canvas pages.
| Attachment | Size |
|---|---|
| fb_user_changes.diff | 22.65 KB |

#1
I ve been working on a little module that maps the fb account to the user account on the drupal site.
It works but it's not well integrated into the fb module.
#2
Here's a cleaner patch that applies to the very latest modules/fb/ (do a cvs update). There's some good progress here. The code is new and I may not have tested every permutation. I've also left a bunch of debug output the screen and watchdog. However I'm eager to get folks using this so I'm submitting anyway.
This patch adds...
#3
To domidc,
Thanks for sharing your module. Its short and sweet but I went a different direction because I did not want to introduce any new forms. For example I have a site which alters the login form and I wouldn't want to have to start altering yet another login form if you know what I mean. Also I did not want to force the user to have to type their username and password again, they've already logged into the drupal site and facebook. And there are times when it's possible to avoid it.
And just nitpicking, better to use user_set_authmaps rather than write to the table directly.
#4
You're right. Now everything is well integrated. The automatic mapping is great.
Thanks!
#5
Patch checked in.
#6
Automatically closed -- issue fixed for two weeks with no activity.