Wednesday, 8 June 2011

How to Find a Facebook User ID

The Facebook Like button is ever more prevalent, with countless uses all over the web, but many site administrators will want to control the way that 'Likes' for their sites appear on users' news feeds, in particular by specifying their own logo or graphic to accompany the story.

In order to do this, Facebook requires that the 'Liked' page participate in the Open Graph, so that an Open Graph image can be specified.

This is a relatively straight-forward affair, involving the addition of a collection of <meta> tags defining og: properties (which, annoyingly don't validate as compliant HTML, but that's another story), but there is one requirement that appears to have been added after the initial roll-out, as pages that omitted it worked before and then suddenly stopped working.

That requirement is for the specification of fb:app_id or fb:admins in order to provide administrative authority for your pages within the Open Graph.

While fb:app_id (Application ID) is easy to find, fb:admins requires the user ID of one or more administering users - and this ID can be rather difficult to find when the users have deployed vanity URLs, which mask their normal profile page URL, which includes their user ID.

There are all sorts of crazy ways documented on the Internet to find the ID of a user, but thankfully Facebook provide a proper way that doesn't involve hiring a private detective.

All one needs to do is request the information for the user in question directly from the Open Graph, like this:

I've documented this in more detail in the XenForo User Manual, and even provided a form to make the process as easy as possible:

How to Find the ID of a Facebook User

No comments:

Post a Comment