I have enabled the extended permissions and it asks for the email address. When users log in via facebook, the module create automatically a local account. But even when the permission for email is given the email is not filled in on the local account.
Isn't it supposed to work in the function fb_user_user($op, &$edit, &$account, $category = NULL) in the fb_user.module file? Or do I need some custom code in my account module?

Thanks for your help!

Comments

gorgo’s picture

I can't figure out how to do it either...
help?

Dave Cohen’s picture

For the time being you need some custom code. In 2.x, when Drupal for Facebook creates an account, the email address is not known. In 3.x, it is possible to request the email extended permission before the user first registers, so it might become simpler. I'm not sure yet.

The further complication is that user's can provide a "proxy" email address and these are long strings. Too long to fit in drupal's users.mail column.

gorgo’s picture

I'm actually using 3.x and checked the box for email on the extended permissions options, but for some reason it doesn't work. Not sure what I'm missing...

Dave Cohen’s picture

extended perms modules is not even ported to 3.x yet. This is obvious when you install modules/fb fresh, but not obvious when you upgrade from 2.x.

In 3.x, you can prompt for extended perms when a user first authorizes. So for example you can configure the facebook connect block and add perms="email" as an attribute to the fb:login-button tag.

gorgo’s picture

Thanks for the quick reply, Dave!

This is the first time I'm installing this module. I haven't upgraded from 2.x, and I'm not entirely sure what features are functioning or not in 3.x.
Is it actually possible to get and save the users email when they authorize the connection to the site with this module?
If so, could you please tell me how I should go about it?

I have checked the box for the extended permission in the settings page, but if I understand correctly, this has no effect yet?
I would have tried to add the perms="email" bit to the block, but I'm having the weirdest problem and can't get the block to save when I choose the region where I want it to be (This is only happening for this block. every other block works fine).
Also, if I add it to the block, will this module know to add the email it gets from facebook to the email field in drupal's users table?

Thank you!

gorgo’s picture

Ok... I set the block to appear where I want it in the database (still not sure why that happened) and added perms="email" to the button and it DOES work!
Thank you!

Dave Cohen’s picture

When I install 3.x and visit admin >> site building >> modules, the extended permissions module says "this version is incompatible..." and it can't be enabled. So I don't understand how you're using that module with 3.x.

gorgo’s picture

hmmm not to me it doesn't...
it says: "Extended Permissions allow apps to provide additional features, like posting to Streams and sending email. This module helps you prompt users to grant those permissions" and I had no problem enabling it...

Dave Cohen’s picture

Huh. The core line in fb_permission.info is supposed to be commented out. It's not ported to 3.x. For now just manually edit the perms attribute of the login-button.

Anyone who wants to help upgrade fb_permssion.module please get in touch with me.

jaypark’s picture

dave i'd like to help upgrade the fb_permission.module - if you've already divided, i'll help conquer.

Dave Cohen’s picture

I'm working on it now, as part of supporting the "new data model" that's going into effect on the 30th. So don't touch anything just yet. Wait till I check this in then I'll get in touch.

gorgo’s picture

Hi Dave,
I've found another bug (I think) when using extended permissions.
Right now when a user connects to the site for the first time with facebook an account is created and the email address from facebook is saved in the account.
I've tested a scenario that might happen when a user already registered to the site as a regular user, and is now logged out and decides to use facebook connect.
In that case I get a "duplicate entry error in fb_user_app table" error and end up with 2 different user accounts using the same email address.

I've checked the "Map account when both local uid and Facebook id are known" box, but I guess that only works for logged in users. Is there a way to fix that?
Thank you!

Dave Cohen’s picture

gorgo, if its not too much trouble, could you submit that as its own issue?

gorgo’s picture

sorry
The error I got is:

user warning: Duplicate entry '2661752988_28a11b9dd8d455bd555b23fd100dff21' for key 'email_hash' query: INSERT INTO fb_register (uid, email_hash) VALUES (150, '2661752988_28a11b9dd8d455bd555b23fd100dff21') in /home/murmurc/public_html/sites/all/modules/fb/contrib/fb_register.module on line 319

gorgo’s picture

yeah sure, sorry.
Doin it now

phoenix’s picture

This means I'll have to make some kind of cron hook that will get the email to save it on the profile if the user has accepted to share his email?

Donkzilla’s picture

hi I'm Robert, this is my first post here.

I was having the same problem described in the original post. After reading this thread I upgraded to 3.x-dev and added perms="email" in the facebook connect block. It worked, email now gets added to to the local acccount, but only from external facebook connect pages, not from facebook app canvas pages. Before I upgraded to 3.x-dev I could connect/authorize my app from canvas pages and my test facebook user account would be created locally (without email being inserted). But now with 3.x-dev I get constant page refreshes after authorizing the app from a canvas page, and no account is created locally.

In summary, authorizing from apps.facebook.com/example-app results in constant page refeshes and no local user account created; and authorizing from my-site.com works ok, user and facebook email insert into a local user account.

I've tried changing Post-Authorize Redirect URL in my facebook app settings and I've tried changing facebook canvas pages settings in this module. Still no luck. I need to make my site to work entirely within facebook app iframe canvas pages.

Dave Cohen’s picture

Robert, could you please submit that as a new issue? And please answer these questions when describing it...

When you authorize on the canvas pages, are you doing so via the same connect button?

On the facebook side, what are your apps settings under the "migrations" tab? Specifically the "new sdks" setting. Try enabling that and see if the same problem persists.

millions’s picture

Dave, I got the email to work and load in user account. Is there a way to get it to automatically subscribe to a newsletter since they've given permission to be contacted? I'm currently using simplenews, and have it configured to opt in automatically unless the user un-checks a box on registration. I was hoping this would be enough since when the user is auto created via FB Connect, it wouldn't opt-out. Unfortunately, it didn't subscribe. I know this is somewhat related to this post, but I can repost if you'd like.

Thanks.

Dave Cohen’s picture

Status: Active » Closed (won't fix)

better support for email in 3.x branch.