I'm trying to allow new users to register for my Wordpress site using their Facebook account. I know how to create a new user manually, but I'm not sure how to handle situations in which a user has already registered for the site with an email address that's different from their facebook account.
I need to create an official WP user, but I don't want pre-existing users to end up with two different acccounts (if their Facebook email doesn't match their pre-existing email). I'm not sure if there is a way to assign multiple emails to one account. Even if there is, I suspect this will be problematic.
What's the best way to handle this?
In case anyone cares, I added a meta field to the new user when the user is created. This is easy to do with update_user_meta(). This meta field holds the user's facebook id, so I can check to see if it already exists every time I create a new user. Also easily done with get_users().
Related
In advent of the new V2 Facebook Open Graph API, I need to make note of the logged in users 'App-Scoped' user ID, in order to register the id with Parse in order to receive PUSH notifications.
However, as the logged in user I get the Facebook ID instead.
Haven't found anything in the docs to solve this problem yet, so thought I better ask here.
If you created your facebook application before the introduction of graph API 2.0, It will continue to receive the canonical facebook user ID
If you created your facebook application, after the introduction of graph API 2.0, It gives you app scoped id instead of the canonical id.
In this case I assume your application is quite old.Therefor create a new app and it will give you the app scope id.
In facebook document:
"The id of this person's user account. This ID is unique to each app
and cannot be used across different apps. Our upgrade guide provides
more info about this." You only get id with each apps.
more information in here: facebook.developers
The "Facebook ID" as you call it IS the App-scoped User ID.
See https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids
The id you get from the api's is an opaque string, and you should use it as such.
If the user has already granted your app access on v1, then your app will continue to receive the same id.
The old users who have registered keep receiving the canonical ID from Facebook for those users, and new users are getting the new scoped ID. Although it is working fine as a long integer, I suggest to change the long field for a string field (unless you already treat it as a string), because we cannot know what Facebook will send here in the future. To keep your code mainly unchanged, create a new internal user id long integer which will be the one your code is already using, and relate it with the string ID from Facebook, which is canonical or scoped, depending if the user registered before or after the migration, and which you will have to manage only for logins, requests, open graph stories, etc.
This way you have not worry about canonical or scoped id EXCEPT one case. Everything works fine, except we found a problem, and maybe somebody can correct me and so help me to solve this: when a new user accept a invite request from an existing user, when your app reads the ID of the sender of the request, I found that Facebook gives you the new scoped id ALWAYS, no mater if the referrer is old or new user. This way, if a user registered before the migration, you have stored the canonical ID, and later, you read a request from this user accepted for a new one, you get the scoped id from the old user, but what you have stored is the canonical one! As result, old users can no more invite new users properly! If anyone knows how getting canonical ids from requests sent for old users, or knows how to obtain the scoped ids for the existing users with canonical ids (to store the new scoped ids in the database) it would be very helpful to hear their suggestions.
Facebook offers a mechanism to convert a personal profile into a fan page. I am currently dealing with a user who had her personal profile connected to our Facebook app. She then did the conversion and now can no longer access her profile in the app.
From what I can see, it appears that the ID of her old personal account does no longer exist in Facebook. The converted fan page has a new ID. She cannot access the app with the page identity (which is a general restriction for pages, I think). She then created a new personal profile but that of course has a new ID as well.
So I am facing the situation that there are two entries in the database, one with the old deleted ID and one with the new account ID. I can merge these two app profiles manually and make them use the ID of the new personal account.
But I would like to handle this problem automatically and transparently to the user or at least in a way they can do the merge themselves. It seems to be difficult since the old account is already destroyed and I do not have any way to associate the new personal account with the existing app profile.
Do you know of a good way to deal with this problem? The only way I can see is to have people generate an authorization link before doing the conversion and later on use it to do the merge. But i guess most often they would do it the other way round and end up with a broken profile.
I'm trying to add someone as an admin to an app I'm working on, but I'm not "friends" with them. When I type their email address in when trying to add them as an admin, it says that user isn't on Facebook. Yet, when I do a search for the user on Facebook using that email address, it finds them instantly.
The only thing I can think of is that this person isn't my friend?
According to the documentation, you do not need to be friends. Then again the docs may have not been updated to reflect a change in policy.
https://developers.facebook.com/docs/guides/games/development-cycle/
Users can be added by specifying their name (if they are your friend), email address or Facebook User ID. Users are not required to be friends in order to be added to a Role.
Try their Facebook User ID. If that doesn't work just friend them and try that way.
Just tested this at length. It appears you DO have to be friends with someone on FB to add them as an admin to your app. (Note that this is totally different then adding them as a Page Admin, where apparently you do not need to be friends.)
You can just add their email address (but they have to like the page and the email address used needs to be associated with their Facebook account).
I have a yard sale website that I'm about to revamp, and rather than using my own user database, I'd like to use Facebook connect to authenticate people into my site, and the only reason I need them to do that in the first place is so after a yard sale is posted on my site, I'd like to be able to post on their wall that they're having a yard sale.
So, my two questions are:
Is it possible to use Facebook Connect without my own user database? I understand that I'll have to store the facebook ID, etc.. within a database table, and that's no problem, I just don't want to give the confusing option of "click here to create an account" + "click here to login with your user name and password" + "Or click here to login with facebook". I'd just like the last option.
Second question is, is there any way to force the user to allow me to post on their wall? I understand that they can uncheck that option when signing in with facebook, but can I verify that permission and ask them to re-login with that option checked? I'm not trying to be a prick, I'm offering a fantastic service that is completely free and in exchange I just want the ability to post their sale on their own wall so I can spread the word. I'd prefer for this to not be optional.
To answer your first question, yes. You don't need your own user database, however you will need to save your users auth key and id to be able to post as them - whenever you want. If you dont need to be able to post anytime (like when the user is not online) but only on user actions on your webpage (which is probably most common) there is alternatives like just saving the data in a session. So depending on what your needs are, you don't necessarily need a database at all.
Second question, you can always check if a user has granted a permission using the API. So what you can do is have a page that says that he has to approve to proceed to your page and a link to the auth dialog. Although, I don't recommend it, I doubt It's gonna do you any good and It's possible that Facebook even disapproves of this. The possibility to remove extended permissions is probably there for a reason.
More about checking granted permissions here using the REST API:
http://developers.facebook.com/docs/reference/rest/users.hasAppPermission/
I want to set up my site to allow people to sign in using a facebook account. But in the near future I would also want to allow a provision to allow people to sign up using twitter, linkedin, even their open id accounts if they have one. However I need to set up my system so that a user may be able to login using whatever way he wishes and yet be able to maintain all his logins with his one account.
I have a users table which has the basic details:
USERS:
ID|NAME|EMAIL|PASSWORD
And think I should set up a logins table in this case like:
USERS_LOGINS
USER_ID|LOGIN_TYPE|LOGIN_ID
like in the second table if he signs up using facebook the Login type would read Facebook and id would be his fb id and so forth.
Is there any kind of service that already does this for you or any open source code I can use? My application is being built on the zend framework
Thanks
You might want to check out Janrain Engage. It will probably be the fastest and easiest way to support multiple login types.