fb_user_create_local_user problem
mcassino - November 27, 2007 - 02:54
| Project: | Drupal for Facebook |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Dave Cohen |
| Status: | needs review |
Description
fb_user_create_local_user() does not declare $fb_app as global.
When is invoked, the "authname" field of authmap table get the form "$fbu-@facebook.com" instead of "$fbu-$fb_app->apikey@facebook.com", so fb_user_get_local_user($fbu,$fb_app) called from outside fb_user module does not work.

#1
Thanks for pointing this out. I'm sure it worked at some point, but it's been a while since I've used the app-specific setting.
I'll change that function to take the fb_app as a parameter, instead of the app_specific flag.
#2
#3
Here's how I'm thinking of changing fb_user_create_local_user. I'm changing the way local accounts are named, in order to avoid name collisions. I'm also allowing third-party modules implementing hook_fb to alter the suggested name, in case folks are not happy with the change. And I'm changing the signature of fb_user_create_local_user to make it future-compatable.
#4
Ok, I just applied this patch. For the most part it seems to work. The first time I installed my app using a duplicate name I got what looked like an error I got before I installed the simplexml stuff. However, I then clicked my app name and it loaded it fine and everything seemed great. The user was added to the db with a name of fbu@facebook. This is fine with me as it will encourage users to select a username and keep them anonymous before they do that.
I deleted the app and the db entries and reinstalled it twice but could not duplicate that initial error.
Excellent work!
#5
Is there any security/privacy concern with exposing a facebook user id? In my case, any user that doesn't change their username will have that ID exposed as author for any content they add.
Thanks.
#6
Nathan,
If you get an error like you described in #4, please copy and paste the text of the error here. Also, when you say the name is fbu@facebook, do you mean literally "fbu@facebook" or do you mean 1234...@facebook?
Regarding #5, it's easy to learn a facebook user's id number, even for users who are not a friend.
I plan to change the name scheme to be "John Doe 123456789@facebook", instead of just "123456789@facebook", before checking in this patch. That is, include the name, but append the fbu to ensure uniqueness
#7
Dave,
If that error pops up again, I'll definitely post it. Sorry, I would've copied it, but I clicked through and it went away....and hasn't been back.
The name has the actual number in it, like it should.
And based on what you said, it doesn't seem like having the facebook user number visible is a big deal. The way you have the patch working now is fine with me; if you change it later, that should be ok too. :)
Thanks.