O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Checking Page Properties

Problem

I need to find out if a user is the admin of a Page, or if a Page has my app installed, or whether a user is a fan of a specific Page.

Solution

Use the Pages.isAdmin() method to find out whether the current loggedinuser is an admin of a specific Page:

$result = $facebook->api_client->pages_isAdmin('123456789');

where 123456789 is the pageid of the Page you’re interested in.

Use the Pages.isFan() method to find out whether a user is a fan of a specific Page:

$result = $facebook->api_client->pages_isFan('123456789', '12345');

where 123456789 is the pageid of the Page you’re interested in, and 12345 is the optional uid of the user you want to check for (it defaults to the current loggedinuser if you leave it off).

Use the Pages.hasAppAdded() method to find out if a specific Page has your app added:

$result = $facebook->api_client->pages_hasAppAdded('123456789');

where 123456789 is the pageid of the Page you’re interested in.

Discussion

All three methods return true (1) if the thing you’re checking is true, or false (0) if it isn’t (or the pageid can’t be found).

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required