I have an app on facebook, which is kind of a competition between users. Each user gains points and the one with most points wins.
I keep the IDs of the users in a table in my database. When a user enters the app, there’s a script that checks if he is already in the table, and if not, it adds the user id to the table.
Then, I have a page that shows all of the users and how many points they have. I get through the graph api the user’s name by his ID, and then shows it on a nice table.
The only problem is: when a user that used the application once deletes it from his installed application on facebook, I can’t get his name anymore, and I get an uncaught OAuth exception.
How can I check if the user has installed the app, so I can display his name only if the app is currently installed on his facebook?
Basically, here is what you would need to do.
This makes an API request for the current logged in user and, provided it fails, catches the exception and sets the $user variable to null. Then you can do a simple check to see if $user exists.
Hopefully this will point you in the right direction.