Saturday 1 March 2014

How to Find the ID of a Facebook User

The Facebook Admin IDs setting in XenForo requires that you enter the Facebook user ID(s) of the designated administrators for that page within the Open Graph.
Finding the Facebook user ID of a person (even yourself) can be a little challenging, but once you know where to look it's very simple.
Facebook gives users the ability to select a unique username or 'vanity URL' for their member profile. Effectively, this will convert the original URL to a member profile from www.facebook.com/profile.php?id=100005435978040 to www.facebook.com/MrHasnainAzhar.
The process to find a user ID differs depending on whether or not the user has selected a username.

Users Without a Username

These users are simple. All you need to do is find a link to their profile page, copy the URL of the link and save the long number specified by profile.php?id=100005435978040 . You can then take this number and paste it into the Facebook Admin IDs setting in XenForo.

Users With a Username

Facebook hides the ID of these users, and there are all sorts of crazy ways documented on the Internet describing ways to find their user ID, but there is only one proper method.
To find the user ID of a named user, you must query the Open Graph. Every object within the Open Graph has a unique URL that can be inspected and will return information about that object. Users are no exception.
The URL to a named user is http://graph.facebook.com/username, and will return a JSON object containing information about that user:
{
   "id": "100005435978040",
   "name": "Hasnain Azhar",
   "first_name": "Hasnain",
   "last_name": "Azhar",
   "link": "http://www.facebook.com/MrHasnainAzhar",
   "gender": "male",
   "locale": "en_US",
   "username": "MrHasnainAzhar"
}
The user ID is specified in the id property. Simply copy this value (without the quotation marks) and paste it into the Facebook Admin IDs setting in XenForo.

No comments:

Post a Comment